You are here

function quiz_ddlines_schema in Quiz 7.4

Same name and namespace in other branches
  1. 8.4 question_types/quiz_ddlines/quiz_ddlines.install \quiz_ddlines_schema()

Implements hook_schema().

File

question_types/quiz_ddlines/quiz_ddlines.install, line 72
Sponsored by: Senter for IKT i utdanningen Code: paalj

Code

function quiz_ddlines_schema() {
  $schema['quiz_ddlines_node'] = array(
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'vid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'feedback_enabled' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'hotspot_radius' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 10,
      ),
      'ddlines_elements' => array(
        'type' => 'text',
      ),
      'execution_mode' => array(
        'type' => 'int',
        'description' => "Execution mode. 0->with lines, 1->without lines",
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'foreign keys' => array(
      'node' => array(
        'table' => 'node',
        'columns' => array(
          'nid' => 'nid',
        ),
      ),
    ),
    'primary key' => array(
      'vid',
      'nid',
    ),
  );

  // Place to store user answers
  $schema['quiz_ddlines_user_answers'] = array(
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'result_id' => array(
        'type' => 'int',
        '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,
      ),
    ),
    'primary key' => array(
      'id',
    ),
    'indexes' => array(
      'answer_id' => array(
        'result_id',
        'question_nid',
        'question_vid',
      ),
    ),
  );
  $schema['quiz_ddlines_user_answer_multi'] = array(
    'fields' => array(
      'user_answer_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'hotspot_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'label_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
    ),
    'foreign keys' => array(
      'answer_id' => array(
        'table' => 'quiz_ddlines_user_answers',
        'columns' => array(
          'user_answer_id' => 'id',
        ),
      ),
    ),
    'indexes' => array(
      'answer_id' => array(
        'user_answer_id',
      ),
    ),
  );
  return $schema;
}