You are here

function quizfileupload_schema in Quiz File Upload 7

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

Implementation of hook_schema().

File

./quizfileupload.install, line 25
Code: logicmedia

Code

function quizfileupload_schema() {

  // Stores the users answers to a question.
  $schema['quiz_fileupload_user_answers'] = array(
    'fields' => array(
      'answer_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,
      ),
      'score' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'fid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'answer_id',
    ),
    'indexes' => array(
      'answer_id' => array(
        'result_id',
        'question_nid',
        'question_vid',
      ),
    ),
  );

  // store node properties
  $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',
      ),
    ),
    'primary key' => array(
      'nid',
      'vid',
    ),
  );
  return $schema;
}