]> git.mjollnir.org Git - moodle.git/commitdiff
Reorder the table definitions in the file, to group them more logically.
authortjhunt <tjhunt>
Mon, 14 Aug 2006 13:32:39 +0000 (13:32 +0000)
committertjhunt <tjhunt>
Mon, 14 Aug 2006 13:32:39 +0000 (13:32 +0000)
mod/quiz/db/mysql.sql
mod/quiz/db/postgres7.sql

index 9f14122b3dc9d3d0b6cc6986c9aa85a1ee4833d2..9d603a85fd1f6c77c5f9285059a956718935e56a 100644 (file)
@@ -1,20 +1,13 @@
--- phpMyAdmin SQL Dump
--- version 2.6.0-pl1
--- http://www.phpmyadmin.net
--- 
--- Host: localhost
--- Generation Time: Jun 05, 2005 at 04:32 PM
--- Server version: 4.0.15
--- PHP Version: 4.3.3
--- 
--- Database: `moodle15`
--- 
-
+-- --------------------------------------------------------
+-- Quiz module and question bank table definitions.
+--
+-- The tables are grouped divided by:
+-- quiz/questionbank and definition/runtime.
 -- --------------------------------------------------------
 
--- 
--- Table structure for table `prefix_quiz`
--- 
+-- --------------------------------------------------------
+-- Quiz module, quiz definition data.
+-- --------------------------------------------------------
 
 CREATE TABLE prefix_quiz (
   id int(10) unsigned NOT NULL auto_increment,
@@ -48,27 +41,30 @@ CREATE TABLE prefix_quiz (
   KEY course (course)
 ) TYPE=MyISAM COMMENT='Main information about each quiz';
 
--- --------------------------------------------------------
-
--- 
--- Table structure for table `prefix_question_answers`
--- 
-
-CREATE TABLE prefix_question_answers (
+CREATE TABLE prefix_quiz_question_instances (
   id int(10) unsigned NOT NULL auto_increment,
+  quiz int(10) unsigned NOT NULL default '0',
   question int(10) unsigned NOT NULL default '0',
-  answer text NOT NULL default '',
-  fraction float NOT NULL default '0',
-  feedback text NOT NULL default '',
+  grade smallint(6) NOT NULL default '0',
   PRIMARY KEY  (id),
+  KEY quiz (quiz),
   KEY question (question)
-) TYPE=MyISAM COMMENT='Answers, with a fractional grade (0-1) and feedback';
+) TYPE=MyISAM COMMENT='The grade for a question in a quiz';
 
--- --------------------------------------------------------
+CREATE TABLE prefix_quiz_question_versions (
+  id int(10) unsigned NOT NULL auto_increment,
+  quiz int(10) unsigned NOT NULL default '0',
+  oldquestion int(10) unsigned NOT NULL default '0',
+  newquestion int(10) unsigned NOT NULL default '0',
+  originalquestion int(10) unsigned NOT NULL default '0',
+  userid int(10) unsigned NOT NULL default '0',
+  timestamp int(10) unsigned NOT NULL default '0',
+  PRIMARY KEY  (id)
+) TYPE=MyISAM COMMENT='The mapping between old and new versions of a question';
 
--- 
--- Table structure for table `prefix_quiz_attempts`
--- 
+-- --------------------------------------------------------
+-- Quiz module, quiz runtime data.
+-- --------------------------------------------------------
 
 CREATE TABLE prefix_quiz_attempts (
   id int(10) unsigned NOT NULL auto_increment,
@@ -88,11 +84,24 @@ CREATE TABLE prefix_quiz_attempts (
   KEY userid (userid)
 ) TYPE=MyISAM COMMENT='Stores various attempts on a quiz';
 
--- --------------------------------------------------------
+CREATE TABLE prefix_quiz_grades (
+  id int(10) unsigned NOT NULL auto_increment,
+  quiz int(10) unsigned NOT NULL default '0',
+  userid int(10) unsigned NOT NULL default '0',
+  grade double NOT NULL default '0',
+  timemodified int(10) unsigned NOT NULL default '0',
+  PRIMARY KEY  (id),
+  KEY quiz (quiz),
+  KEY userid (userid)
+) TYPE=MyISAM COMMENT='Final quiz grade (may be best of several attempts)';
 
+-- --------------------------------------------------------
+-- Questionbank definition data.
 -- 
--- Table structure for table `prefix_question_categories`
--- 
+-- TODO, these tables no longer belong to the quiz module.
+-- They should be moved elsewhere when a good home for them
+-- is found.
+-- --------------------------------------------------------
 
 CREATE TABLE prefix_question_categories (
   id int(10) unsigned NOT NULL auto_increment,
@@ -107,11 +116,52 @@ CREATE TABLE prefix_question_categories (
   KEY course (course)
 ) TYPE=MyISAM COMMENT='Categories are for grouping questions';
 
--- --------------------------------------------------------
+CREATE TABLE prefix_question (
+  id int(10) NOT NULL auto_increment,
+  category int(10) NOT NULL default '0',
+  parent int(10) unsigned NOT NULL default '0',
+  name varchar(255) NOT NULL default '',
+  questiontext text NOT NULL,
+  questiontextformat tinyint(2) NOT NULL default '0',
+  image varchar(255) NOT NULL default '',
+  commentarytext text NOT NULL,
+  defaultgrade int(10) unsigned NOT NULL default '1',
+  penalty float NOT NULL default '0.1',
+  qtype varchar(20) NOT NULL default '',
+  length int(10) unsigned NOT NULL default '1',
+  stamp varchar(255) NOT NULL default '',
+  version varchar(255) NOT NULL default '',
+  hidden int(1) unsigned NOT NULL default '0',
+  PRIMARY KEY  (id),
+  KEY category (category)
+) TYPE=MyISAM COMMENT='The quiz questions themselves';
 
--- 
--- Table structure for table `prefix_question_dataset_definitions`
--- 
+CREATE TABLE prefix_question_answers (
+  id int(10) unsigned NOT NULL auto_increment,
+  question int(10) unsigned NOT NULL default '0',
+  answer text NOT NULL default '',
+  fraction float NOT NULL default '0',
+  feedback text NOT NULL default '',
+  PRIMARY KEY  (id),
+  KEY question (question)
+) TYPE=MyISAM COMMENT='Answers, with a fractional grade (0-1) and feedback';
+
+CREATE TABLE prefix_question_numerical_units (
+  id int(10) unsigned NOT NULL auto_increment,
+  question int(10) unsigned NOT NULL default '0',
+  multiplier decimal(40,20) NOT NULL default '1.00000000000000000000',
+  unit varchar(50) NOT NULL default '',
+  PRIMARY KEY  (id),
+  KEY question (question)
+) TYPE=MyISAM COMMENT='Optional unit options for numerical questions';
+
+CREATE TABLE prefix_question_datasets (
+  id int(10) unsigned NOT NULL auto_increment,
+  question int(10) unsigned NOT NULL default '0',
+  datasetdefinition int(10) unsigned NOT NULL default '0',
+  PRIMARY KEY  (id),
+  KEY question (question,datasetdefinition)
+) TYPE=MyISAM COMMENT='Many-many relation between questions and dataset definitions';
 
 CREATE TABLE prefix_question_dataset_definitions (
   id int(10) unsigned NOT NULL auto_increment,
@@ -124,12 +174,6 @@ CREATE TABLE prefix_question_dataset_definitions (
   KEY category (category)
 ) TYPE=MyISAM COMMENT='Organises and stores properties for dataset items';
 
--- --------------------------------------------------------
-
--- 
--- Table structure for table `prefix_question_dataset_items`
--- 
-
 CREATE TABLE prefix_question_dataset_items (
   id int(10) unsigned NOT NULL auto_increment,
   definition int(10) unsigned NOT NULL default '0',
@@ -140,27 +184,15 @@ CREATE TABLE prefix_question_dataset_items (
 ) TYPE=MyISAM COMMENT='Individual dataset items';
 
 -- --------------------------------------------------------
-
--- 
--- Table structure for table `prefix_quiz_grades`
--- 
-
-CREATE TABLE prefix_quiz_grades (
-  id int(10) unsigned NOT NULL auto_increment,
-  quiz int(10) unsigned NOT NULL default '0',
-  userid int(10) unsigned NOT NULL default '0',
-  grade double NOT NULL default '0',
-  timemodified int(10) unsigned NOT NULL default '0',
-  PRIMARY KEY  (id),
-  KEY quiz (quiz),
-  KEY userid (userid)
-) TYPE=MyISAM COMMENT='Final quiz grade (may be best of several attempts)';
-
+-- Questionbank runtime data.
+-- See above TODO.
 -- --------------------------------------------------------
 
--- 
--- Table structure for table `prefix_question_sessions`
--- 
+CREATE TABLE prefix_question_attempts (
+  id int(10) unsigned NOT NULL auto_increment,
+  modulename varchar(20) NOT NULL default 'quiz',
+  PRIMARY KEY  (id)
+) TYPE=MyISAM COMMENT='Student attempts. This table gets extended by the modules';
 
 CREATE TABLE prefix_question_sessions (
   id int(10) unsigned NOT NULL auto_increment,
@@ -174,100 +206,6 @@ CREATE TABLE prefix_question_sessions (
   UNIQUE KEY attemptid (attemptid,questionid)
 ) TYPE=MyISAM COMMENT='Gives ids of the newest open and newest graded states';
 
--- --------------------------------------------------------
-
--- 
--- Table structure for table `prefix_question_numerical_units`
--- 
-
-CREATE TABLE prefix_question_numerical_units (
-  id int(10) unsigned NOT NULL auto_increment,
-  question int(10) unsigned NOT NULL default '0',
-  multiplier decimal(40,20) NOT NULL default '1.00000000000000000000',
-  unit varchar(50) NOT NULL default '',
-  PRIMARY KEY  (id),
-  KEY question (question)
-) TYPE=MyISAM COMMENT='Optional unit options for numerical questions';
-
--- --------------------------------------------------------
-
--- 
--- Table structure for table `prefix_question_datasets`
--- 
-
-CREATE TABLE prefix_question_datasets (
-  id int(10) unsigned NOT NULL auto_increment,
-  question int(10) unsigned NOT NULL default '0',
-  datasetdefinition int(10) unsigned NOT NULL default '0',
-  PRIMARY KEY  (id),
-  KEY question (question,datasetdefinition)
-) TYPE=MyISAM COMMENT='Many-many relation between questions and dataset definitions';
-
--- --------------------------------------------------------
-
--- 
--- Table structure for table `prefix_quiz_question_instances`
--- 
-
-CREATE TABLE prefix_quiz_question_instances (
-  id int(10) unsigned NOT NULL auto_increment,
-  quiz int(10) unsigned NOT NULL default '0',
-  question int(10) unsigned NOT NULL default '0',
-  grade smallint(6) NOT NULL default '0',
-  PRIMARY KEY  (id),
-  KEY quiz (quiz),
-  KEY question (question)
-) TYPE=MyISAM COMMENT='The grade for a question in a quiz';
-
--- --------------------------------------------------------
-
--- 
--- Table structure for table `prefix_quiz_question_versions`
--- 
-
-CREATE TABLE prefix_quiz_question_versions (
-  id int(10) unsigned NOT NULL auto_increment,
-  quiz int(10) unsigned NOT NULL default '0',
-  oldquestion int(10) unsigned NOT NULL default '0',
-  newquestion int(10) unsigned NOT NULL default '0',
-  originalquestion int(10) unsigned NOT NULL default '0',
-  userid int(10) unsigned NOT NULL default '0',
-  timestamp int(10) unsigned NOT NULL default '0',
-  PRIMARY KEY  (id)
-) TYPE=MyISAM COMMENT='The mapping between old and new versions of a question';
-
--- --------------------------------------------------------
-
--- 
--- Table structure for table `prefix_question`
--- 
-
-CREATE TABLE prefix_question (
-  id int(10) NOT NULL auto_increment,
-  category int(10) NOT NULL default '0',
-  parent int(10) unsigned NOT NULL default '0',
-  name varchar(255) NOT NULL default '',
-  questiontext text NOT NULL,
-  questiontextformat tinyint(2) NOT NULL default '0',
-  image varchar(255) NOT NULL default '',
-  commentarytext text NOT NULL,
-  defaultgrade int(10) unsigned NOT NULL default '1',
-  penalty float NOT NULL default '0.1',
-  qtype varchar(20) NOT NULL default '',
-  length int(10) unsigned NOT NULL default '1',
-  stamp varchar(255) NOT NULL default '',
-  version varchar(255) NOT NULL default '',
-  hidden int(1) unsigned NOT NULL default '0',
-  PRIMARY KEY  (id),
-  KEY category (category)
-) TYPE=MyISAM COMMENT='The quiz questions themselves';
-
--- --------------------------------------------------------
-
--- 
--- Table structure for table `prefix_question_states`
--- 
-
 CREATE TABLE prefix_question_states (
   id int(10) unsigned NOT NULL auto_increment,
   attempt int(10) unsigned NOT NULL default '0',
@@ -286,20 +224,9 @@ CREATE TABLE prefix_question_states (
 ) TYPE=MyISAM COMMENT='Stores user responses to a quiz, and percentage grades';
 
 -- --------------------------------------------------------
-
--- 
--- Table structure for table `prefix_question_attempts`
--- 
-
-CREATE TABLE prefix_question_attempts (
-  id int(10) unsigned NOT NULL auto_increment,
-  modulename varchar(20) NOT NULL default 'quiz',
-  PRIMARY KEY  (id)
-) TYPE=MyISAM COMMENT='Student attempts. This table gets extended by the modules';
-
+-- Quiz log actions.
 -- --------------------------------------------------------
 
-
 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'add', 'quiz', 'name');
 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'update', 'quiz', 'name');
 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'view', 'quiz', 'name');
index 4570aa5d49a90dce513df7d54ea9a49199c8a54c..9f7528b29231e504bdc27308937b4780633745f0 100644 (file)
@@ -1,17 +1,13 @@
-# phpMyAdmin MySQL-Dump
-# version 2.3.2-dev
-# http://www.phpmyadmin.net/ (download page)
-#
-# Host: localhost
-# Generation Time: Oct 16, 2002 at 01:12 AM
-# Server version: 3.23.49
-# PHP Version: 4.2.3
-# Database : moodle
-# --------------------------------------------------------
+-- --------------------------------------------------------
+-- Quiz module and question bank table definitions.
+--
+-- The tables are grouped divided by:
+-- quiz/questionbank and definition/runtime.
+-- --------------------------------------------------------
 
-#
-# Table structure for table prefix_quiz
-#
+-- --------------------------------------------------------
+-- Quiz module, quiz definition data.
+-- --------------------------------------------------------
 
 CREATE TABLE prefix_quiz (
   id SERIAL PRIMARY KEY,
@@ -42,30 +38,30 @@ CREATE TABLE prefix_quiz (
   delay1 integer NOT NULL default '0',
   delay2 integer NOT NULL default '0'
 );
-
 CREATE INDEX prefix_quiz_course_idx ON prefix_quiz (course);
 
-# --------------------------------------------------------
-
-#
-# Table structure for table prefix_question_answers
-#
-
-CREATE TABLE prefix_question_answers (
+CREATE TABLE prefix_quiz_question_instances (
   id SERIAL PRIMARY KEY,
+  quiz integer NOT NULL default '0',
   question integer NOT NULL default '0',
-  answer text NOT NULL default '',
-  fraction real NOT NULL default '0',
-  feedback text NOT NULL default ''
+  grade integer NOT NULL default '0'
 );
+CREATE INDEX prefix_quiz_question_instances_quiz_idx ON prefix_quiz_question_instances (quiz);
+CREATE INDEX prefix_quiz_question_instances_question_idx ON prefix_quiz_question_instances (question);
 
-CREATE INDEX prefix_question_answers_question_idx ON prefix_question_answers (question);
-
+CREATE TABLE prefix_quiz_question_versions (
+  id SERIAL PRIMARY KEY,
+  quiz integer NOT NULL default '0',
+  oldquestion integer NOT NULL default '0',
+  newquestion integer NOT NULL default '0',
+  originalquestion integer NOT NULL default '0',
+  userid integer NOT NULL default '0',
+  timestamp integer NOT NULL default '0'
+);
 
-# --------------------------------------------------------
-#
-# Table structure for table prefix_quiz_attempts
-#
+-- --------------------------------------------------------
+-- Quiz module, quiz runtime data.
+-- --------------------------------------------------------
 
 CREATE TABLE prefix_quiz_attempts (
   id SERIAL PRIMARY KEY,
@@ -80,16 +76,28 @@ CREATE TABLE prefix_quiz_attempts (
   layout text NOT NULL default '',
   preview integer NOT NULL default '0'
 );
-
 CREATE INDEX prefix_quiz_attempts_quiz_idx ON prefix_quiz_attempts (quiz);
 CREATE INDEX prefix_quiz_attempts_userid_idx ON prefix_quiz_attempts (userid);
 CREATE UNIQUE INDEX prefix_quiz_attempts_uniqueid_uk ON prefix_quiz_attempts (uniqueid);
 
-# --------------------------------------------------------
+CREATE TABLE prefix_quiz_grades (
+  id SERIAL PRIMARY KEY,
+  quiz integer NOT NULL default '0',
+  userid integer NOT NULL default '0',
+  grade real NOT NULL default '0',
+  timemodified integer NOT NULL default '0'
+);
 
-#
-# Table structure for table prefix_question_categories
-#
+CREATE INDEX prefix_quiz_grades_quiz_idx ON prefix_quiz_grades (quiz);
+CREATE INDEX prefix_quiz_grades_userid_idx ON prefix_quiz_grades (userid);
+
+-- --------------------------------------------------------
+-- Questionbank definition data.
+-- 
+-- TODO, these tables no longer belong to the quiz module.
+-- They should be moved elsewhere when a good home for them
+-- is found.
+-- --------------------------------------------------------
 
 CREATE TABLE prefix_question_categories (
   id SERIAL PRIMARY KEY,
@@ -101,14 +109,50 @@ CREATE TABLE prefix_question_categories (
   parent integer NOT NULL default '0',
   sortorder integer NOT NULL default '999'
 );
-
 CREATE INDEX prefix_question_categories_course_idx ON prefix_question_categories (course);
 
-# --------------------------------------------------------
-#
-# Table structure for table prefix_question_dataset_definitions
-#
+CREATE TABLE prefix_question (
+  id SERIAL PRIMARY KEY,
+  category integer NOT NULL default '0',
+  parent integer NOT NULL default '0',
+  name varchar(255) NOT NULL default '',
+  questiontext text NOT NULL default '',
+  questiontextformat integer NOT NULL default '0',
+  image varchar(255) NOT NULL default '',
+  commentarytext text NOT NULL default '',
+  defaultgrade integer NOT NULL default '1',
+  penalty real NOT NULL default '0.1',
+  qtype varchar(20) NOT NULL default '0',
+  length integer NOT NULL DEFAULT '1',
+  stamp varchar(255) NOT NULL default '',
+  version varchar(255) NOT NULL default '',
+  hidden integer NOT NULL default '0'
+);
+CREATE INDEX prefix_question_category_idx ON prefix_question (category);
+
+CREATE TABLE prefix_question_answers (
+  id SERIAL PRIMARY KEY,
+  question integer NOT NULL default '0',
+  answer text NOT NULL default '',
+  fraction real NOT NULL default '0',
+  feedback text NOT NULL default ''
+);
+CREATE INDEX prefix_question_answers_question_idx ON prefix_question_answers (question);
+
+CREATE TABLE prefix_question_numerical_units (
+    id SERIAL8 PRIMARY KEY,
+    question INT8  NOT NULL default '0',
+    multiplier decimal(40,20) NOT NULL default '1.00000000000000000000',
+    unit varchar(50) NOT NULL default ''
+);
+CREATE INDEX prefix_question_numerical_units_question_idx ON prefix_question_numerical_units (question);
 
+CREATE TABLE prefix_question_datasets (
+    id SERIAL8 PRIMARY KEY,
+    question INT8  NOT NULL default '0',
+    datasetdefinition INT8  NOT NULL default '0'
+);
+CREATE INDEX prefix_question_datasets_question_datasetdefinition_idx  ON prefix_question_datasets (question,datasetdefinition);
 
 CREATE TABLE prefix_question_dataset_definitions (
     id SERIAL8 PRIMARY KEY,
@@ -118,47 +162,26 @@ CREATE TABLE prefix_question_dataset_definitions (
     options varchar(255) NOT NULL default '',
     itemcount INT8  NOT NULL default '0'
 );
-
 CREATE INDEX prefix_question_dataset_definitions_category_idx ON prefix_question_dataset_definitions (category);
 
-# --------------------------------------------------------
-#
-# Table structure for table prefix_question_dataset_items
-#
-
 CREATE TABLE prefix_question_dataset_items (
     id SERIAL8 PRIMARY KEY,
     definition INT8  NOT NULL default '0',
     number INT8  NOT NULL default '0',
     value varchar(255) NOT NULL default ''
 );
-
 CREATE INDEX prefix_question_dataset_items_definition_idx  ON prefix_question_dataset_items (definition);
 
-# --------------------------------------------------------
-
-#
-# Table structure for table prefix_quiz_grades
-#
+-- --------------------------------------------------------
+-- Questionbank runtime data.
+-- See above TODO.
+-- --------------------------------------------------------
 
-CREATE TABLE prefix_quiz_grades (
+CREATE TABLE prefix_question_attempts (
   id SERIAL PRIMARY KEY,
-  quiz integer NOT NULL default '0',
-  userid integer NOT NULL default '0',
-  grade real NOT NULL default '0',
-  timemodified integer NOT NULL default '0'
+  modulename varchar(20) NOT NULL default 'quiz'
 );
 
-CREATE INDEX prefix_quiz_grades_quiz_idx ON prefix_quiz_grades (quiz);
-CREATE INDEX prefix_quiz_grades_userid_idx ON prefix_quiz_grades (userid);
-
-# --------------------------------------------------------
-
-#
-# Table structure for table prefix_question_sessions
-#
-
-
 CREATE TABLE prefix_question_sessions (
   id SERIAL PRIMARY KEY,
   attemptid integer NOT NULL default '0',
@@ -168,111 +191,8 @@ CREATE TABLE prefix_question_sessions (
   sumpenalty real NOT NULL default '0',
   comment text NOT NULL default ''
 );
-
 CREATE UNIQUE INDEX prefix_question_sessions_attempt_idx ON prefix_question_sessions (attemptid,questionid);
 
-# --------------------------------------------------------
-#
-# Table structure for table prefix_question_numerical_units
-#
-
-CREATE TABLE prefix_question_numerical_units (
-    id SERIAL8 PRIMARY KEY,
-    question INT8  NOT NULL default '0',
-    multiplier decimal(40,20) NOT NULL default '1.00000000000000000000',
-    unit varchar(50) NOT NULL default ''
-);
-
-CREATE INDEX prefix_question_numerical_units_question_idx ON prefix_question_numerical_units (question);
-
-# --------------------------------------------------------
-#
-# Table structure for table prefix_question_datasets
-#
-
-CREATE TABLE prefix_question_datasets (
-    id SERIAL8 PRIMARY KEY,
-    question INT8  NOT NULL default '0',
-    datasetdefinition INT8  NOT NULL default '0'
-);
-
-CREATE INDEX prefix_question_datasets_question_datasetdefinition_idx  ON prefix_question_datasets (question,datasetdefinition);
-
-# --------------------------------------------------------
-
-#
-# Table structure for table prefix_quiz_question_instances
-#
-
-CREATE TABLE prefix_quiz_question_instances (
-  id SERIAL PRIMARY KEY,
-  quiz integer NOT NULL default '0',
-  question integer NOT NULL default '0',
-  grade integer NOT NULL default '0'
-);
-
-CREATE INDEX prefix_quiz_question_instances_quiz_idx ON prefix_quiz_question_instances (quiz);
-CREATE INDEX prefix_quiz_question_instances_question_idx ON prefix_quiz_question_instances (question);
-
-# --------------------------------------------------------
-
-#
-# Table structure for table prefix_quiz_question_versions
-#
-
-CREATE TABLE prefix_quiz_question_versions (
-  id SERIAL PRIMARY KEY,
-  quiz integer NOT NULL default '0',
-  oldquestion integer NOT NULL default '0',
-  newquestion integer NOT NULL default '0',
-  originalquestion integer NOT NULL default '0',
-  userid integer NOT NULL default '0',
-  timestamp integer NOT NULL default '0'
-);
-
-# --------------------------------------------------------
-
-#
-# Table structure for table prefix_question
-#
-
-CREATE TABLE prefix_question (
-  id SERIAL PRIMARY KEY,
-  category integer NOT NULL default '0',
-  parent integer NOT NULL default '0',
-  name varchar(255) NOT NULL default '',
-  questiontext text NOT NULL default '',
-  questiontextformat integer NOT NULL default '0',
-  image varchar(255) NOT NULL default '',
-  commentarytext text NOT NULL default '',
-  defaultgrade integer NOT NULL default '1',
-  penalty real NOT NULL default '0.1',
-  qtype varchar(20) NOT NULL default '0',
-  length integer NOT NULL DEFAULT '1',
-  stamp varchar(255) NOT NULL default '',
-  version varchar(255) NOT NULL default '',
-  hidden integer NOT NULL default '0'
-);
-
-CREATE INDEX prefix_question_category_idx ON prefix_question (category);
-
-# --------------------------------------------------------
-
-#
-# Table structure for table prefix_question_attempts
-#
-
-CREATE TABLE prefix_question_attempts (
-  id SERIAL PRIMARY KEY,
-  modulename varchar(20) NOT NULL default 'quiz'
-);
-
-# --------------------------------------------------------
-
-#
-# Table structure for table prefix_question_states
-#
-
 CREATE TABLE prefix_question_states (
   id SERIAL PRIMARY KEY,
   attempt integer NOT NULL default '0',
@@ -286,10 +206,12 @@ CREATE TABLE prefix_question_states (
   raw_grade real NOT NULL default '0',
   penalty real NOT NULL default '0'
 );
-
 CREATE INDEX prefix_question_states_attempt_idx ON prefix_question_states (attempt);
 CREATE INDEX prefix_question_states_question_idx ON prefix_question_states (question);;
 
+-- --------------------------------------------------------
+-- Quiz log actions.
+-- --------------------------------------------------------
 
 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'add', 'quiz', 'name');
 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'update', 'quiz', 'name');