2002-12-23 11:47:17 +00:00
|
|
|
CREATE TABLE prefix_config (
|
2002-12-15 02:41:07 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
name varchar(255) NOT NULL default '',
|
2004-01-29 04:13:55 +00:00
|
|
|
value text NOT NULL default '',
|
2002-12-15 02:41:07 +00:00
|
|
|
CONSTRAINT config_name_uk UNIQUE (name)
|
|
|
|
);
|
|
|
|
|
2002-12-23 11:47:17 +00:00
|
|
|
CREATE TABLE prefix_course (
|
2002-12-15 02:41:07 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
category integer NOT NULL default '0',
|
2003-08-07 16:01:31 +00:00
|
|
|
sortorder integer NOT NULL default '0',
|
2002-12-15 02:41:07 +00:00
|
|
|
password varchar(50) NOT NULL default '',
|
|
|
|
fullname varchar(254) NOT NULL default '',
|
|
|
|
shortname varchar(15) NOT NULL default '',
|
|
|
|
summary text NOT NULL default '',
|
2003-08-10 14:36:52 +00:00
|
|
|
format varchar(10) NOT NULL default 'topics',
|
2003-08-20 07:32:24 +00:00
|
|
|
showgrades integer NOT NULL default '1',
|
2002-12-15 02:41:07 +00:00
|
|
|
modinfo text NOT NULL default '',
|
|
|
|
newsitems integer NOT NULL default '1',
|
|
|
|
teacher varchar(100) NOT NULL default 'Teacher',
|
|
|
|
teachers varchar(100) NOT NULL default 'Teachers',
|
|
|
|
student varchar(100) NOT NULL default 'Student',
|
|
|
|
students varchar(100) NOT NULL default 'Students',
|
|
|
|
guest integer NOT NULL default '0',
|
|
|
|
startdate integer NOT NULL default '0',
|
|
|
|
numsections integer NOT NULL default '1',
|
2003-09-10 13:48:19 +00:00
|
|
|
showrecent integer NOT NULL default '1',
|
2002-12-15 02:41:07 +00:00
|
|
|
marker integer NOT NULL default '0',
|
2003-10-06 18:02:35 +00:00
|
|
|
maxbytes integer NOT NULL default '0',
|
2003-10-31 05:57:30 +00:00
|
|
|
showreports integer NOT NULL default '0',
|
2003-07-21 07:31:01 +00:00
|
|
|
visible integer NOT NULL default '1',
|
2003-12-30 17:18:06 +00:00
|
|
|
groupmode integer NOT NULL default '0',
|
|
|
|
groupmodeforce integer NOT NULL default '0',
|
2004-02-09 07:31:04 +00:00
|
|
|
lang varchar(5) NOT NULL default '',
|
2002-12-15 02:41:07 +00:00
|
|
|
timecreated integer NOT NULL default '0',
|
|
|
|
timemodified integer NOT NULL default '0'
|
|
|
|
);
|
|
|
|
|
2003-08-21 08:14:56 +00:00
|
|
|
CREATE INDEX prefix_course_category_idx ON prefix_course (category);
|
|
|
|
|
2002-12-23 11:47:17 +00:00
|
|
|
CREATE TABLE prefix_course_categories (
|
2002-12-15 02:41:07 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
2003-08-28 18:00:36 +00:00
|
|
|
name varchar(255) NOT NULL default '',
|
2003-07-30 13:02:45 +00:00
|
|
|
description text NOT NULL default '',
|
|
|
|
parent integer NOT NULL default '0',
|
|
|
|
sortorder integer NOT NULL default '0',
|
2003-08-19 09:26:36 +00:00
|
|
|
coursecount integer NOT NULL default '0',
|
2003-07-30 13:02:45 +00:00
|
|
|
visible integer NOT NULL default '1',
|
2003-08-28 18:00:36 +00:00
|
|
|
timemodified integer NOT NULL default '0'
|
2002-12-15 02:41:07 +00:00
|
|
|
);
|
|
|
|
|
2003-04-28 13:29:26 +00:00
|
|
|
CREATE TABLE prefix_course_display (
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
course integer NOT NULL default '0',
|
|
|
|
userid integer NOT NULL default '0',
|
|
|
|
display integer NOT NULL default '0'
|
|
|
|
);
|
|
|
|
|
2003-05-03 06:44:03 +00:00
|
|
|
CREATE INDEX prefix_course_display_courseuserid_idx ON prefix_course_display (course,userid);
|
2003-04-28 13:29:26 +00:00
|
|
|
|
2002-12-23 11:47:17 +00:00
|
|
|
CREATE TABLE prefix_course_modules (
|
2002-12-15 02:41:07 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
course integer NOT NULL default '0',
|
|
|
|
module integer NOT NULL default '0',
|
|
|
|
instance integer NOT NULL default '0',
|
|
|
|
section integer NOT NULL default '0',
|
|
|
|
added integer NOT NULL default '0',
|
|
|
|
deleted integer NOT NULL default '0',
|
2003-04-14 15:11:09 +00:00
|
|
|
score integer NOT NULL default '0',
|
2003-09-14 16:31:33 +00:00
|
|
|
indent integer NOT NULL default '0',
|
2004-01-11 17:44:09 +00:00
|
|
|
visible integer NOT NULL default '1',
|
|
|
|
groupmode integer NOT NULL default '0'
|
2002-12-15 02:41:07 +00:00
|
|
|
);
|
|
|
|
|
2002-12-23 11:47:17 +00:00
|
|
|
CREATE TABLE prefix_course_sections (
|
2002-12-15 02:41:07 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
course integer NOT NULL default '0',
|
|
|
|
section integer NOT NULL default '0',
|
|
|
|
summary text NOT NULL default '',
|
2003-07-21 14:28:04 +00:00
|
|
|
sequence text NOT NULL default '',
|
2003-05-04 07:59:46 +00:00
|
|
|
visible integer NOT NULL default '1'
|
2002-12-15 02:41:07 +00:00
|
|
|
);
|
|
|
|
|
2004-01-17 09:47:45 +00:00
|
|
|
CREATE TABLE prefix_event (
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
name varchar(255) NOT NULL default '',
|
|
|
|
description text,
|
|
|
|
courseid integer NOT NULL default '0',
|
|
|
|
groupid integer NOT NULL default '0',
|
|
|
|
userid integer NOT NULL default '0',
|
|
|
|
modulename varchar(20) NOT NULL default '',
|
|
|
|
instance integer NOT NULL default '0',
|
|
|
|
eventtype varchar(20) NOT NULL default '',
|
|
|
|
timestart integer NOT NULL default '0',
|
|
|
|
timeduration integer NOT NULL default '0',
|
|
|
|
timemodified integer NOT NULL default '0'
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE INDEX prefix_event_courseid_idx ON prefix_event (courseid);
|
|
|
|
CREATE INDEX prefix_event_userid_idx ON prefix_event (userid);
|
|
|
|
|
2003-12-30 18:07:09 +00:00
|
|
|
CREATE TABLE prefix_groups (
|
2003-12-30 17:18:06 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
courseid integer NOT NULL default '0',
|
|
|
|
name varchar(255) NOT NULL default '',
|
|
|
|
description text,
|
|
|
|
lang varchar(10) NOT NULL default '',
|
|
|
|
picture integer NOT NULL default '0',
|
2004-02-15 07:29:55 +00:00
|
|
|
hidepicture integer NOT NULL default '0',
|
2003-12-30 17:18:06 +00:00
|
|
|
timecreated integer NOT NULL default '0',
|
|
|
|
timemodified integer NOT NULL default '0'
|
|
|
|
);
|
|
|
|
|
2003-12-30 18:07:09 +00:00
|
|
|
CREATE INDEX prefix_groups_idx ON prefix_groups (courseid);
|
2003-12-30 17:18:06 +00:00
|
|
|
|
2003-12-30 18:07:09 +00:00
|
|
|
CREATE TABLE prefix_groups_members (
|
2003-12-30 17:18:06 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
groupid integer NOT NULL default '0',
|
|
|
|
userid integer NOT NULL default '0',
|
|
|
|
timeadded integer NOT NULL default '0'
|
|
|
|
);
|
|
|
|
|
2003-12-30 18:07:09 +00:00
|
|
|
CREATE INDEX prefix_groups_members_idx ON prefix_groups_members (groupid);
|
2003-12-30 17:18:06 +00:00
|
|
|
|
2002-12-23 11:47:17 +00:00
|
|
|
CREATE TABLE prefix_log (
|
2002-12-15 02:41:07 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
time integer NOT NULL default '0',
|
2002-12-23 09:39:26 +00:00
|
|
|
userid integer NOT NULL default '0',
|
2002-12-15 02:41:07 +00:00
|
|
|
ip varchar(15) NOT NULL default '',
|
|
|
|
course integer NOT NULL default '0',
|
2003-01-06 13:40:05 +00:00
|
|
|
module varchar(20) NOT NULL default '',
|
2004-01-31 14:47:57 +00:00
|
|
|
cmid integer NOT NULL default '0',
|
2003-01-06 13:40:05 +00:00
|
|
|
action varchar(20) NOT NULL default '',
|
2002-12-15 02:41:07 +00:00
|
|
|
url varchar(100) NOT NULL default '',
|
|
|
|
info varchar(255) NOT NULL default ''
|
|
|
|
);
|
|
|
|
|
2003-05-03 06:44:03 +00:00
|
|
|
CREATE INDEX prefix_log_coursemoduleaction_idx ON prefix_log (course,module,action);
|
2003-07-28 02:51:56 +00:00
|
|
|
CREATE INDEX prefix_log_timecoursemoduleaction_idx ON prefix_log (time,course,module,action);
|
2003-05-03 06:44:03 +00:00
|
|
|
CREATE INDEX prefix_log_courseuserid_idx ON prefix_log (course,userid);
|
2003-04-27 09:54:03 +00:00
|
|
|
|
2002-12-23 11:47:17 +00:00
|
|
|
CREATE TABLE prefix_log_display (
|
2002-12-15 02:41:07 +00:00
|
|
|
module varchar(20) NOT NULL default '',
|
|
|
|
action varchar(20) NOT NULL default '',
|
|
|
|
mtable varchar(20) NOT NULL default '',
|
|
|
|
field varchar(40) NOT NULL default ''
|
|
|
|
);
|
|
|
|
|
2002-12-23 11:47:17 +00:00
|
|
|
CREATE TABLE prefix_modules (
|
2002-12-15 02:41:07 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
name varchar(20) NOT NULL default '',
|
|
|
|
version integer NOT NULL default '0',
|
|
|
|
cron integer NOT NULL default '0',
|
|
|
|
lastcron integer NOT NULL default '0',
|
2003-05-09 13:32:27 +00:00
|
|
|
search varchar(255) NOT NULL default '',
|
|
|
|
visible integer NOT NULL default '1'
|
2002-12-15 02:41:07 +00:00
|
|
|
);
|
|
|
|
|
2003-08-15 14:17:15 +00:00
|
|
|
CREATE TABLE prefix_scale (
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
courseid integer NOT NULL default '0',
|
|
|
|
userid integer NOT NULL default '0',
|
|
|
|
name varchar(255) NOT NULL default '',
|
|
|
|
scale text,
|
|
|
|
description text,
|
|
|
|
timemodified integer NOT NULL default '0'
|
|
|
|
);
|
|
|
|
|
2004-02-12 07:06:07 +00:00
|
|
|
|
|
|
|
CREATE TABLE prefix_cache_filters (
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
filter varchar(32) NOT NULL default '',
|
|
|
|
version integer NOT NULL default '0',
|
|
|
|
md5key varchar(32) NOT NULL default '',
|
|
|
|
rawtext text,
|
|
|
|
timemodified integer NOT NULL default '0'
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE INDEX prefix_cache_filters_filtermd5key_idx ON prefix_cache_filters (filter,md5key);
|
|
|
|
|
|
|
|
|
2004-02-09 13:10:19 +00:00
|
|
|
CREATE TABLE prefix_cache_text (
|
2004-02-09 12:27:34 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
md5key varchar(32) NOT NULL default '',
|
|
|
|
formattedtext text,
|
|
|
|
timemodified integer NOT NULL default '0'
|
|
|
|
);
|
|
|
|
|
2004-02-12 07:06:07 +00:00
|
|
|
CREATE INDEX prefix_cache_text_md5key_idx ON prefix_cache_text (md5key);
|
|
|
|
|
|
|
|
|
2002-12-23 11:47:17 +00:00
|
|
|
CREATE TABLE prefix_user (
|
2002-12-15 02:41:07 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
confirmed integer NOT NULL default '0',
|
|
|
|
deleted integer NOT NULL default '0',
|
|
|
|
username varchar(100) NOT NULL default '',
|
|
|
|
password varchar(32) NOT NULL default '',
|
|
|
|
idnumber varchar(12) default NULL,
|
|
|
|
firstname varchar(20) NOT NULL default '',
|
|
|
|
lastname varchar(20) NOT NULL default '',
|
|
|
|
email varchar(100) NOT NULL default '',
|
2004-02-20 09:02:27 +00:00
|
|
|
emailstop integer NOT NULL default '0',
|
2002-12-15 02:41:07 +00:00
|
|
|
icq varchar(15) default NULL,
|
|
|
|
phone1 varchar(20) default NULL,
|
|
|
|
phone2 varchar(20) default NULL,
|
|
|
|
institution varchar(40) default NULL,
|
|
|
|
department varchar(30) default NULL,
|
|
|
|
address varchar(70) default NULL,
|
|
|
|
city varchar(20) default NULL,
|
|
|
|
country char(2) default NULL,
|
2003-05-04 16:05:59 +00:00
|
|
|
lang varchar(5) NOT NULL default '',
|
2002-12-15 02:41:07 +00:00
|
|
|
timezone float NOT NULL default '99',
|
|
|
|
firstaccess integer NOT NULL default '0',
|
|
|
|
lastaccess integer NOT NULL default '0',
|
|
|
|
lastlogin integer NOT NULL default '0',
|
|
|
|
currentlogin integer NOT NULL default '0',
|
|
|
|
lastIP varchar(15) default NULL,
|
|
|
|
secret varchar(15) default NULL,
|
|
|
|
picture integer default NULL,
|
|
|
|
url varchar(255) default NULL,
|
|
|
|
description text,
|
|
|
|
mailformat integer NOT NULL default '1',
|
|
|
|
maildisplay integer NOT NULL default '2',
|
2003-05-23 05:32:40 +00:00
|
|
|
htmleditor integer NOT NULL default '1',
|
|
|
|
autosubscribe integer NOT NULL default '1',
|
2002-12-15 02:41:07 +00:00
|
|
|
timemodified integer NOT NULL default '0',
|
|
|
|
CONSTRAINT user_username_uk UNIQUE (username)
|
|
|
|
);
|
|
|
|
|
2002-12-23 11:47:17 +00:00
|
|
|
CREATE TABLE prefix_user_admins (
|
2002-12-15 02:41:07 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
2002-12-23 09:39:26 +00:00
|
|
|
userid integer NOT NULL default '0'
|
2002-12-15 02:41:07 +00:00
|
|
|
);
|
|
|
|
|
2004-01-28 14:14:19 +00:00
|
|
|
CREATE TABLE prefix_user_preferences (
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
userid integer NOT NULL default '0',
|
|
|
|
name varchar(50) NOT NULL default '',
|
|
|
|
value varchar(255) NOT NULL default ''
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE INDEX prefix_user_preferences_useridname_idx ON prefix_user_preferences (userid,name);
|
|
|
|
|
2002-12-23 11:47:17 +00:00
|
|
|
CREATE TABLE prefix_user_students (
|
2002-12-15 02:41:07 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
2002-12-23 09:39:26 +00:00
|
|
|
userid integer NOT NULL default '0',
|
2002-12-15 02:41:07 +00:00
|
|
|
course integer NOT NULL default '0',
|
2002-12-23 09:39:26 +00:00
|
|
|
timestart integer NOT NULL default '0',
|
|
|
|
timeend integer NOT NULL default '0',
|
2003-10-27 12:38:00 +00:00
|
|
|
time integer NOT NULL default '0',
|
|
|
|
timeaccess integer NOT NULL default '0'
|
2002-12-15 02:41:07 +00:00
|
|
|
);
|
|
|
|
|
2003-07-28 02:51:56 +00:00
|
|
|
CREATE INDEX prefix_user_students_courseuserid_idx ON prefix_user_students (course,userid);
|
|
|
|
|
2002-12-23 11:47:17 +00:00
|
|
|
CREATE TABLE prefix_user_teachers (
|
2002-12-15 02:41:07 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
2002-12-23 09:39:26 +00:00
|
|
|
userid integer NOT NULL default '0',
|
2002-12-15 02:41:07 +00:00
|
|
|
course integer NOT NULL default '0',
|
|
|
|
authority integer NOT NULL default '3',
|
2003-08-16 05:19:24 +00:00
|
|
|
role varchar(40) NOT NULL default '',
|
|
|
|
editall integer NOT NULL default '1',
|
2003-10-27 12:38:00 +00:00
|
|
|
timemodified integer NOT NULL default '0',
|
|
|
|
timeaccess integer NOT NULL default '0'
|
2002-12-15 02:41:07 +00:00
|
|
|
);
|
2002-12-23 11:47:17 +00:00
|
|
|
|
2003-07-28 02:51:56 +00:00
|
|
|
CREATE INDEX prefix_user_teachers_courseuserid_idx ON prefix_user_teachers (course,userid);
|
|
|
|
|
|
|
|
CREATE TABLE prefix_user_coursecreators (
|
2003-02-24 18:48:55 +00:00
|
|
|
id SERIAL8 PRIMARY KEY,
|
|
|
|
userid int8 NOT NULL default '0'
|
|
|
|
);
|
2002-12-23 11:47:17 +00:00
|
|
|
|
|
|
|
INSERT INTO prefix_log_display VALUES ('user', 'view', 'user', 'CONCAT(firstname," ",lastname)');
|
2003-08-27 09:33:12 +00:00
|
|
|
INSERT INTO prefix_log_display VALUES ('course', 'user report', 'user', 'CONCAT(firstname," ",lastname)');
|
2003-01-01 08:15:55 +00:00
|
|
|
INSERT INTO prefix_log_display VALUES ('course', 'view', 'course', 'fullname');
|
|
|
|
INSERT INTO prefix_log_display VALUES ('course', 'update', 'course', 'fullname');
|
|
|
|
INSERT INTO prefix_log_display VALUES ('course', 'enrol', 'course', 'fullname');
|
|
|
|
INSERT INTO prefix_log_display VALUES ('course', 'update', 'course', 'fullname');
|