You are here

function long_answer_schema in Quiz 7.5

Same name and namespace in other branches
  1. 8.4 question_types/long_answer/long_answer.install \long_answer_schema()
  2. 6.6 question_types/long_answer/long_answer.install \long_answer_schema()
  3. 6.3 question_types/long_answer/long_answer.install \long_answer_schema()
  4. 6.4 question_types/long_answer/long_answer.install \long_answer_schema()
  5. 6.5 question_types/long_answer/long_answer.install \long_answer_schema()
  6. 7.6 question_types/long_answer/long_answer.install \long_answer_schema()
  7. 7 question_types/long_answer/long_answer.install \long_answer_schema()
  8. 7.4 question_types/long_answer/long_answer.install \long_answer_schema()

Implements hook_schema().

File

question_types/long_answer/long_answer.install, line 21
Long_answer questions install file.

Code

function long_answer_schema() {

  // Properties for a question nodes go in here:
  $schema['quiz_long_answer_node_properties'] = array(
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'vid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'rubric' => array(
        'type' => 'text',
      ),
      'rubric_format' => array(
        'type' => 'varchar',
        'length' => 255,
        'description' => 'Text format for the rubric text.',
      ),
      'answer_text_processing' => array(
        'type' => 'int',
        'size' => 'tiny',
        'description' => 'Whether or not to allow filtered text answers.',
      ),
    ),
    'primary key' => array(
      'nid',
      'vid',
    ),
  );

  // User answers go in here.
  $schema['quiz_long_answer_user_answers'] = array(
    'fields' => array(
      'answer_id' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'result_answer_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
      ),
      'score' => array(
        'type' => 'float',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'is_evaluated' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'default' => 0,
        'not null' => TRUE,
      ),
      'answer' => array(
        'type' => 'text',
      ),
      'answer_format' => array(
        'type' => 'varchar',
        'length' => 255,
        'description' => 'Text format for the answer text.',
      ),
      'answer_feedback' => array(
        'type' => 'text',
      ),
      'answer_feedback_format' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
    ),
    'primary key' => array(
      'answer_id',
    ),
    'unique keys' => array(
      'result_answer_id' => array(
        'result_answer_id',
      ),
    ),
  );
  return $schema;
}