merged from STABLE18
[moodle-linuxchix.git] / mod / glossary / db / mysql.sql
bloba4c7bbf53a1f1583cb8cc9012abe605fc93f45ee
1 # This file contains a complete database schema for all the 
2 # tables used by this 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
8 # Table structure for table `glossary`
11 CREATE TABLE prefix_glossary (
12      id int(10) unsigned NOT NULL auto_increment,
13      course int(10) unsigned NOT NULL default '0',
14      name varchar(255) NOT NULL default '',
15      intro text NOT NULL default '',
16      studentcanpost tinyint(2) unsigned NOT NULL default '0',
17      allowduplicatedentries tinyint(2) unsigned NOT NULL default '0',
18      displayformat varchar(50) NOT NULL default 'dictionary',
19      mainglossary tinyint(2) unsigned NOT NULL default '0',
20      showspecial tinyint(2) unsigned NOT NULL default '1',
21      showalphabet tinyint(2) unsigned NOT NULL default '1',
22      showall tinyint(2) unsigned NOT NULL default '1',
23      allowcomments tinyint(2) unsigned NOT NULL default '0',
24      allowprintview tinyint(2) unsigned NOT NULL default '1',
25      usedynalink tinyint(2) unsigned NOT NULL default '1',
26      defaultapproval tinyint(2) unsigned NOT NULL default '1',
27      globalglossary tinyint(2) unsigned NOT NULL default '0',
28      entbypage tinyint(3) unsigned NOT NULL default '10',
29      editalways tinyint(2) unsigned NOT NULL default '0',
30      rsstype tinyint(2) unsigned NOT NULL default '0',
31      rssarticles tinyint(2) unsigned NOT NULL default '0',
32      assessed int(10) unsigned NOT NULL default '0',
33      assesstimestart int(10) unsigned NOT NULL default '0',
34      assesstimefinish int(10) unsigned NOT NULL default '0',
35      scale int(10) NOT NULL default '0',
36      timecreated int(10) unsigned NOT NULL default '0',
37      timemodified int(10) unsigned NOT NULL default '0',
38      PRIMARY KEY  (id),
39      KEY course (course)
40 ) TYPE=MyISAM COMMENT='all glossaries';
43 # Table structure for table `glossary_entries`
46 CREATE TABLE prefix_glossary_entries (
47      id int(10) unsigned NOT NULL auto_increment,
48      glossaryid int(10) unsigned NOT NULL default '0',
49      userid int(10) unsigned NOT NULL default '0',
50      concept varchar(255) NOT NULL default '',
51      definition text NOT NULL default '',
52      format tinyint(2) unsigned NOT NULL default '0',
53      attachment VARCHAR(100) NOT NULL default '',
54      timecreated int(10) unsigned NOT NULL default '0',
55      timemodified int(10) unsigned NOT NULL default '0',
56      teacherentry tinyint(2) unsigned NOT NULL default '0',
57      sourceglossaryid int(10) unsigned NOT NULL default '0',
58      usedynalink tinyint(2) unsigned NOT NULL default '1',
59      casesensitive tinyint(2) unsigned NOT NULL default '0',
60      fullmatch tinyint(2) unsigned NOT NULL default '1',
61      approved tinyint(2) unsigned NOT NULL default '1',
62      PRIMARY KEY  (id),
63      KEY glossaryid (glossaryid),
64      KEY userid (userid),
65      KEY concept (concept)
66 ) TYPE=MyISAM COMMENT='all glossary entries';
69 # Table structure for table `glossary_alias`
72 CREATE TABLE prefix_glossary_alias (
73      id int(10) unsigned NOT NULL auto_increment,
74      entryid int(10) unsigned NOT NULL default '0',
75      alias varchar(255) NOT NULL default '',
76      PRIMARY KEY  (id), 
77      KEY entryid (entryid)
78 ) TYPE=MyISAM COMMENT='entries alias';
81 # Table structure for table `glossary_cageories`
84 CREATE TABLE prefix_glossary_categories (
85      id int(10) unsigned NOT NULL auto_increment,
86      glossaryid int(10) unsigned NOT NULL default '0',
87      name varchar(255) NOT NULL default '',
88      usedynalink tinyint(2) unsigned NOT NULL default '1',
89      PRIMARY KEY  (id),
90      KEY glossaryid (glossaryid)
91 ) TYPE=MyISAM COMMENT='all categories for glossary entries';
94 # Table structure for table `glossary_entries_category`
97 CREATE TABLE prefix_glossary_entries_categories (
98      id int(10) unsigned NOT NULL auto_increment,
99      categoryid int(10) unsigned NOT NULL default '0',
100      entryid int(10) unsigned NOT NULL default '0',
101      PRIMARY KEY  (id),
102      KEY entryid (entryid),
103      KEY categoryid (categoryid) 
104 ) TYPE=MyISAM COMMENT='categories of each glossary entry';
106 CREATE TABLE prefix_glossary_comments (
107      id int(10) unsigned NOT NULL auto_increment,
108      entryid int(10) unsigned NOT NULL default '0',
109      userid int(10) unsigned NOT NULL default '0',
110      entrycomment text NOT NULL default '',
111      format tinyint(2) unsigned NOT NULL default '0',
112      timemodified int(10) unsigned NOT NULL default '0',
113      PRIMARY KEY  (id),
114      KEY userid (userid),
115      KEY entryid (entryid)
116 ) TYPE=MyISAM COMMENT='comments on glossary entries';
118 CREATE TABLE prefix_glossary_formats (
119      id int(10) unsigned NOT NULL auto_increment,
120      name varchar(50) NOT NULL default '',
121      popupformatname varchar(50) NOT NULL default '',
122      visible tinyint(2) unsigned NOT NULL default '1',
123      showgroup tinyint(2) unsigned NOT NULL default '1',
124      defaultmode varchar(50) NOT NULL default '',
125      defaulthook varchar(50) NOT NULL default '',
126      sortkey varchar(50) NOT NULL default '',
127      sortorder varchar(50) NOT NULL default '',
128      PRIMARY KEY  (id)
129 ) TYPE=MyISAM COMMENT='Setting of the display formats';
132 # Table structure for table `forum_ratings`
135 CREATE TABLE prefix_glossary_ratings (
136   id int(10) unsigned NOT NULL auto_increment,
137   userid int(10) unsigned NOT NULL default '0',
138   entryid int(10) unsigned NOT NULL default '0',
139   time int(10) unsigned NOT NULL default '0',
140   rating tinyint(4) NOT NULL default '0',
141   PRIMARY KEY  (id),
142   KEY userid (userid),
143   KEY entryid (entryid)
144 ) COMMENT='Contains user ratings for entries';
145 # --------------------------------------------------------
148 # Dumping data for table `log_display`
151 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'add', 'glossary', 'name');
152 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'update', 'glossary', 'name');
153 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'view', 'glossary', 'name');
154 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'view all', 'glossary', 'name');
155 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'add entry', 'glossary', 'name');
156 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'update entry', 'glossary', 'name');
157 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'add category', 'glossary', 'name');
158 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'update category', 'glossary', 'name');
159 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'delete category', 'glossary', 'name');
160 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'add comment', 'glossary', 'name');
161 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'update comment', 'glossary', 'name');
162 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'delete comment', 'glossary', 'name');
163 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'approve entry', 'glossary', 'name');
164 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'view entry', 'glossary_entries', 'concept');