1 # This file contains a complete database schema for all the
2 # tables used by the mlesson module, written in SQL
4 # It may also contain INSERT statements for particular data
5 # that may be used, especially new entries in the table log_display
7 CREATE TABLE `prefix_lesson` (
8 `id` int(10) unsigned NOT NULL auto_increment,
9 `course` int(10) unsigned NOT NULL default '0',
10 `name` varchar(255) NOT NULL default '',
11 `practice` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
12 `modattempts` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
13 `usepassword` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
14 `password` VARCHAR(32) NOT NULL default '',
15 `grade` tinyint(3) NOT NULL default '0',
16 `custom` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
17 `ongoing` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
18 `usemaxgrade` tinyint(3) NOT NULL default '0',
19 `maxanswers` int(3) unsigned NOT NULL default '4',
20 `maxattempts` int(3) unsigned NOT NULL default '5',
21 `review` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
22 `nextpagedefault` int(3) unsigned NOT NULL default '0',
23 `minquestions` int(3) unsigned NOT NULL default '0',
24 `maxpages` int(3) unsigned NOT NULL default '0',
25 `timed` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
26 `maxtime` INT(10) UNSIGNED NOT NULL DEFAULT '0',
27 `retake` int(3) unsigned NOT NULL default '1',
28 `tree` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
29 `slideshow` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
30 `width` INT(10) UNSIGNED NOT NULL DEFAULT '640',
31 `height` INT(10) UNSIGNED NOT NULL DEFAULT '480',
32 `bgcolor` CHAR(7) NOT NULL DEFAULT '#FFFFFF',
33 `displayleft` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
34 `highscores` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
35 `maxhighscores` INT(10) UNSIGNED NOT NULL DEFAULT '0',
36 `available` int(10) unsigned NOT NULL default '0',
37 `deadline` int(10) unsigned NOT NULL default '0',
38 `timemodified` int(10) unsigned NOT NULL default '0',
40 KEY `course` (`course`)
41 ) COMMENT='Defines lesson';
42 # --------------------------------------------------------
44 CREATE TABLE `prefix_lesson_pages` (
45 `id` int(10) unsigned NOT NULL auto_increment,
46 `lessonid` int(10) unsigned NOT NULL default '0',
47 `prevpageid` int(10) unsigned NOT NULL default '0',
48 `nextpageid` int(10) unsigned NOT NULL default '0',
49 `qtype` tinyint(3) unsigned NOT NULL default '0',
50 `qoption` tinyint(3) unsigned NOT NULL default '0',
51 `layout` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
52 `display` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
53 `timecreated` int(10) unsigned NOT NULL default '0',
54 `timemodified` int(10) unsigned NOT NULL default '0',
55 `title` varchar(255) NOT NULL default '',
56 `contents` text NOT NULL default '',
58 KEY `lessonid` (`lessonid`)
59 ) COMMENT='Defines lesson_pages';
60 # --------------------------------------------------------
62 CREATE TABLE `prefix_lesson_answers` (
63 `id` int(10) unsigned NOT NULL auto_increment,
64 `lessonid` int(10) unsigned NOT NULL default '0',
65 `pageid` int(10) unsigned NOT NULL default '0',
66 `jumpto` int(11) NOT NULL default '0',
67 `grade` tinyint(3) unsigned NOT NULL default '0',
68 `score` INT(10) NOT NULL DEFAULT '0',
69 `flags` tinyint(3) unsigned NOT NULL default '0',
70 `timecreated` int(10) unsigned NOT NULL default '0',
71 `timemodified` int(10) unsigned NOT NULL default '0',
72 `answer` text NOT NULL default '',
73 `response` text NOT NULL default '',
76 KEY `lessonid` (`lessonid`)
77 ) COMMENT='Defines lesson_answers';
78 # --------------------------------------------------------
80 CREATE TABLE `prefix_lesson_attempts` (
81 `id` int(10) unsigned NOT NULL auto_increment,
82 `lessonid` int(10) unsigned NOT NULL default '0',
83 `pageid` int(10) unsigned NOT NULL default '0',
84 `userid` int(10) unsigned NOT NULL default '0',
85 `answerid` int(10) unsigned NOT NULL default '0',
86 `retry` int(3) unsigned NOT NULL default '0',
87 `correct` int(10) unsigned NOT NULL default '0',
88 `useranswer` text NOT NULL default '',
89 `timeseen` int(10) unsigned NOT NULL default '0',
92 KEY `lessonid` (`lessonid`),
93 KEY `pageid` (`pageid`)
94 ) COMMENT='Defines lesson_attempts';
95 # --------------------------------------------------------
97 CREATE TABLE `prefix_lesson_grades` (
98 `id` int(10) unsigned NOT NULL auto_increment,
99 `lessonid` int(10) unsigned NOT NULL default '0',
100 `userid` int(10) unsigned NOT NULL default '0',
101 `grade` int(3) unsigned NOT NULL default '0',
102 `late` int(3) unsigned NOT NULL default '0',
103 `completed` int(10) unsigned NOT NULL default '0',
105 KEY `lessonid` (`lessonid`),
106 KEY `userid` (`userid`)
107 ) COMMENT='Defines lesson_grades';
108 # --------------------------------------------------------
110 CREATE TABLE `prefix_lesson_default`
111 ( `id` int(10) unsigned NOT NULL auto_increment,
112 `course` int(10) unsigned NOT NULL default '0',
113 `practice` tinyint(3) unsigned NOT NULL default '0',
114 `modattempts` tinyint(3) unsigned NOT NULL default '0',
115 `password` varchar(32) NOT NULL default '',
116 `usepassword` int(3) unsigned NOT NULL default '0',
117 `grade` tinyint(3) NOT NULL default '0',
118 `custom` int(3) unsigned NOT NULL default '0',
119 `ongoing` int(3) unsigned NOT NULL default '0',
120 `usemaxgrade` tinyint(3) unsigned NOT NULL default '0',
121 `maxanswers` int(3) unsigned NOT NULL default '4',
122 `maxattempts` int(3) unsigned NOT NULL default '5',
123 `review` tinyint(3) unsigned NOT NULL default '0',
124 `nextpagedefault` int(3) unsigned NOT NULL default '0',
125 `minquestions` tinyint(3) unsigned NOT NULL default '0',
126 `maxpages` int(3) unsigned NOT NULL default '0',
127 `timed` int(3) unsigned NOT NULL default '0',
128 `maxtime` int(10) unsigned NOT NULL default '0',
129 `retake` int(3) unsigned NOT NULL default '1',
130 `tree` int(3) unsigned NOT NULL default '0',
131 `slideshow` int(3) unsigned NOT NULL default '0',
132 `width` int(10) unsigned NOT NULL default '640',
133 `height` int(10) unsigned NOT NULL default '480',
134 `bgcolor` varchar(7) default '#FFFFFF',
135 `displayleft` int(3) unsigned NOT NULL default '0',
136 `highscores` int(3) unsigned NOT NULL default '0',
137 `maxhighscores` int(10) NOT NULL default '0',
139 ) COMMENT = 'Defines lesson_default';
140 # --------------------------------------------------------
142 CREATE TABLE `prefix_lesson_timer`
143 ( `id` int(10) unsigned NOT NULL auto_increment,
144 `lessonid` int(10) unsigned not null,
145 `userid` int(10) unsigned not null,
146 `starttime` int(10) unsigned not null,
147 `lessontime` int(10) unsigned not null,
150 # --------------------------------------------------------
152 CREATE TABLE `prefix_lesson_branch`
153 ( `id` int(10) unsigned not null auto_increment,
154 `lessonid` int(10) unsigned not null,
155 `userid` int(10) unsigned not null,
156 `pageid` int(10) unsigned not null,
157 `retry` int(10) unsigned not null,
158 `flag` tinyint(3) unsigned not null,
159 `timeseen` int(10) unsigned not null,
162 # --------------------------------------------------------
164 CREATE TABLE `prefix_lesson_high_scores`
165 ( `id` int(10) unsigned not null auto_increment,
166 `lessonid` int(10) unsigned not null,
167 `userid` int(10) unsigned not null,
168 `gradeid` int(10) unsigned not null,
169 `nickname` varchar(5) not null,
172 # --------------------------------------------------------
175 INSERT INTO prefix_log_display VALUES ('lesson', 'start', 'lesson', 'name');
176 INSERT INTO prefix_log_display VALUES ('lesson', 'end', 'lesson', 'name');
177 INSERT INTO prefix_log_display VALUES ('lesson', 'view', 'lesson_pages', 'title');