You are here

function cloze_schema in Cloze 7

Same name and namespace in other branches
  1. 6 cloze.install \cloze_schema()

Implementation of hook_schema().

File

./cloze.install, line 21
The installer file for short_answer.

Code

function cloze_schema() {

  // User answers go in here.
  $schema['quiz_cloze_user_answers'] = array(
    'fields' => array(
      'answer_id' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'question_nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'question_vid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'result_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'score' => array(
        'type' => 'float',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'answer' => array(
        'type' => 'text',
      ),
    ),
    'primary key' => array(
      'answer_id',
    ),
    'unique keys' => array(
      'ids' => array(
        'result_id',
        'question_nid',
        'question_vid',
      ),
    ),
  );
  $schema['quiz_cloze_node_properties'] = array(
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'vid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'learning_mode' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'nid',
      'vid',
    ),
  );
  return $schema;
}