merged from STABLE18
[moodle-linuxchix.git] / mod / glossary / db / postgres7.sql
blob2ae6bbd26abe4f23ee5b31dd5fb3593b9190951f
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 SERIAL,
13      course int4 NOT NULL default '0',
14      name varchar(255) NOT NULL default '',
15      intro text NOT NULL default '',
16      studentcanpost int2 NOT NULL default '0',
17      allowduplicatedentries int2 NOT NULL default '0',
18      displayformat varchar(50) NOT NULL default 'dictionary',
19      mainglossary int2 NOT NULL default '0',
20      showspecial int2 NOT NULL default '1',
21      showalphabet int2 NOT NULL default '1',
22      showall int2 NOT NULL default '1',
23      allowcomments int2 NOT NULL default '0',
24      allowprintview int2 NOT NULL default '1',
25      usedynalink int2 NOT NULL default '1',
26      defaultapproval int2 NOT NULL default '1',
27      globalglossary int2 NOT NULL default '0',
28      entbypage int NOT NULL default '10',
29      editalways integer NOT NULL default '0',
30      rsstype integer NOT NULL default '0',
31      rssarticles integer NOT NULL default '0',
32      assessed int4 NOT NULL default '0',
33      assesstimestart int4 NOT NULL default '0',
34      assesstimefinish int4 NOT NULL default '0',
35      scale int4 NOT NULL default '0',
36      timecreated int4 NOT NULL default '0',
37      timemodified int4 NOT NULL default '0',
38      PRIMARY KEY  (id)
41 CREATE INDEX prefix_glossary_course_idx ON prefix_glossary (course);
45 # Table structure for table `glossary_entries`
48 CREATE TABLE prefix_glossary_entries (
49      id SERIAL,
50      glossaryid int4 NOT NULL default '0',
51      userid int4 NOT NULL default '0',
52      concept varchar(255) NOT NULL default '',
53      definition text NOT NULL,
54      format int2 NOT NULL default '0',
55      attachment VARCHAR(100) NOT NULL default '',
56      timecreated int4 NOT NULL default '0',
57      timemodified int4 NOT NULL default '0',
58      teacherentry int2 NOT NULL default '0',
59      sourceglossaryid int4 NOT NULL default '0',
60      usedynalink int2 NOT NULL default '1',
61      casesensitive int2 NOT NULL default '0',
62      fullmatch int2 NOT NULL default '1',
63      approved int2  NOT NULL default '1',
64      PRIMARY KEY(id)
67 CREATE INDEX prefix_glossary_entries_glossaryid_idx ON prefix_glossary_entries (glossaryid);
68 CREATE INDEX prefix_glossary_entries_userid_idx ON prefix_glossary_entries (userid);
69 CREATE INDEX prefix_glossary_entries_concept_idx ON prefix_glossary_entries (concept);
72 # Table structure for table `glossary_cageories`
75 CREATE TABLE prefix_glossary_categories (
76      id SERIAL,
77      glossaryid int4 NOT NULL default '0',
78      name varchar(255) NOT NULL default '',
79      usedynalink int2 NOT NULL default '1',
80      PRIMARY KEY  (id)
83 CREATE INDEX prefix_glossary_categories_glossaryid_idx ON prefix_glossary_categories (glossaryid);
86 # Table structure for table `glossary_alias`
89 CREATE TABLE prefix_glossary_alias (
90      id SERIAL,
91      entryid int4 NOT NULL default '0',
92      alias varchar(255) NOT NULL,
93      PRIMARY KEY  (id)
96 CREATE INDEX prefix_glossary_alias_entryid_idx ON prefix_glossary_alias (entryid);
99 # Table structure for table `glossary_entries_category`
102 CREATE TABLE prefix_glossary_entries_categories (
103      id SERIAL,
104      categoryid int4 NOT NULL default '0',
105      entryid int4 NOT NULL default '0',
106      PRIMARY KEY  (id)
109 CREATE INDEX prefix_glossary_entries_categories_category_idx ON prefix_glossary_entries_categories (categoryid);
110 CREATE INDEX prefix_glossary_entries_categories_entryid_idx ON prefix_glossary_entries_categories (entryid);
113 # Table structure for table `glossary_comments`
116 CREATE TABLE prefix_glossary_comments (
117      id SERIAL,
118      entryid int4 NOT NULL default '0',
119      userid int4 NOT NULL default '0',
120      entrycomment text NOT NULL,
121      format int2 NOT NULL default '0',
122      timemodified int4 NOT NULL default '0',
123      PRIMARY KEY  (id)
126 CREATE INDEX prefix_glossary_comments_entryid_idx ON prefix_glossary_comments (entryid);
127 CREATE INDEX prefix_glossary_comments_userid_idx ON prefix_glossary_comments (userid);
130 # Table structure for table `glossary_formats`
133 CREATE TABLE prefix_glossary_formats (
134      id SERIAL,
135      name varchar(50) NOT NULL,
136      popupformatname varchar(50) NOT NULL,
137      visible int2 NOT NULL default '1',
138      showgroup int2 NOT NULL default '1',
139      defaultmode varchar(50) NOT NULL default '',
140      defaulthook varchar(50) NOT NULL default '',
141      sortkey varchar(50) NOT NULL default '',
142      sortorder varchar(50) NOT NULL default '',
143      PRIMARY KEY  (id)
148 # Table structure for table `glossary_ratings`
151 CREATE TABLE prefix_glossary_ratings (
152   id SERIAL,
153   userid int4 NOT NULL default '0',
154   entryid int4 NOT NULL default '0',
155   time int4 NOT NULL default '0',
156   rating int4 NOT NULL default '0',
157   PRIMARY KEY  (id)
160 CREATE INDEX prefix_glossary_ratings_userid_idx ON prefix_glossary_ratings (userid);
161 CREATE INDEX prefix_glossary_ratings_entryid_idx ON prefix_glossary_ratings (entryid);
164 # Dumping data for table `log_display`
167 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'add', 'glossary', 'name');
168 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'update', 'glossary', 'name');
169 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'view', 'glossary', 'name');
170 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'view all', 'glossary', 'name');
171 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'add entry', 'glossary', 'name');
172 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'update entry', 'glossary', 'name');
173 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'add category', 'glossary', 'name');
174 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'update category', 'glossary', 'name');
175 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'delete category', 'glossary', 'name');
176 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'add comment', 'glossary', 'name');
177 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'update comment', 'glossary', 'name');
178 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'delete comment', 'glossary', 'name');
179 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'approve entry', 'glossary', 'name');
180 INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'view entry', 'glossary_entries', 'concept');