You are here

function quizfileupload_schema in Quiz File Upload 7.5

Same name and namespace in other branches
  1. 6 quizfileupload.install \quizfileupload_schema()
  2. 7 quizfileupload.install \quizfileupload_schema()
  3. 7.4 quizfileupload.install \quizfileupload_schema()

Implements hook_schema().

File

./quizfileupload.install, line 23
The install file for installing the quizfileupload module.

Code

function quizfileupload_schema() {

  // Properties for a question nodes go in here:
  $schema['quiz_fileupload_node_properties'] = array(
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'vid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'filetypes' => array(
        'type' => 'text',
      ),
      'filesize' => array(
        'type' => 'varchar',
        'description' => "Filesize",
        'length' => 18,
        'not null' => FALSE,
      ),
      'correct_answer_evaluation' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'nid',
      'vid',
    ),
  );

  // User answers go in here.
  $schema['quiz_fileupload_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',
        'not null' => TRUE,
        'default' => 0,
      ),
      'fid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
      ),
      '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;
}