Hide/show individual activities in any section
[moodle.git] / lib / db / postgres7.sql
CommitLineData
a3eea09c 1CREATE TABLE prefix_config (
fd790dfb 2 id SERIAL PRIMARY KEY,
3 name varchar(255) NOT NULL default '',
4 value varchar(255) NOT NULL default '',
5 CONSTRAINT config_name_uk UNIQUE (name)
6);
7
a3eea09c 8CREATE TABLE prefix_course (
fd790dfb 9 id SERIAL PRIMARY KEY,
10 category integer NOT NULL default '0',
11 password varchar(50) NOT NULL default '',
12 fullname varchar(254) NOT NULL default '',
13 shortname varchar(15) NOT NULL default '',
14 summary text NOT NULL default '',
15 format varchar(10) CHECK (format IN ('weeks','social','topics')) NOT NULL default 'weeks',
16 modinfo text NOT NULL default '',
17 newsitems integer NOT NULL default '1',
18 teacher varchar(100) NOT NULL default 'Teacher',
19 teachers varchar(100) NOT NULL default 'Teachers',
20 student varchar(100) NOT NULL default 'Student',
21 students varchar(100) NOT NULL default 'Students',
22 guest integer NOT NULL default '0',
23 startdate integer NOT NULL default '0',
24 numsections integer NOT NULL default '1',
25 marker integer NOT NULL default '0',
26 timecreated integer NOT NULL default '0',
27 timemodified integer NOT NULL default '0'
28);
29
a3eea09c 30CREATE TABLE prefix_course_categories (
fd790dfb 31 id SERIAL PRIMARY KEY,
32 name varchar(255) NOT NULL default ''
33);
34
a3eea09c 35CREATE TABLE prefix_course_modules (
fd790dfb 36 id SERIAL PRIMARY KEY,
37 course integer NOT NULL default '0',
38 module integer NOT NULL default '0',
39 instance integer NOT NULL default '0',
40 section integer NOT NULL default '0',
41 added integer NOT NULL default '0',
42 deleted integer NOT NULL default '0',
1acfbce5 43 score integer NOT NULL default '0',
44 visible integer NOT NULL default '1'
fd790dfb 45);
46
a3eea09c 47CREATE TABLE prefix_course_sections (
fd790dfb 48 id SERIAL PRIMARY KEY,
49 course integer NOT NULL default '0',
50 section integer NOT NULL default '0',
51 summary text NOT NULL default '',
52 sequence varchar(255) NOT NULL default ''
53);
54
a3eea09c 55CREATE TABLE prefix_log (
fd790dfb 56 id SERIAL PRIMARY KEY,
57 time integer NOT NULL default '0',
ebc3bd2b 58 userid integer NOT NULL default '0',
fd790dfb 59 ip varchar(15) NOT NULL default '',
60 course integer NOT NULL default '0',
8af3e379 61 module varchar(20) NOT NULL default '',
62 action varchar(20) NOT NULL default '',
fd790dfb 63 url varchar(100) NOT NULL default '',
64 info varchar(255) NOT NULL default ''
65);
66
a3eea09c 67CREATE TABLE prefix_log_display (
fd790dfb 68 module varchar(20) NOT NULL default '',
69 action varchar(20) NOT NULL default '',
70 mtable varchar(20) NOT NULL default '',
71 field varchar(40) NOT NULL default ''
72);
73
a3eea09c 74CREATE TABLE prefix_modules (
fd790dfb 75 id SERIAL PRIMARY KEY,
76 name varchar(20) NOT NULL default '',
77 version integer NOT NULL default '0',
78 cron integer NOT NULL default '0',
79 lastcron integer NOT NULL default '0',
80 search varchar(255) NOT NULL default ''
81);
82
a3eea09c 83CREATE TABLE prefix_user (
fd790dfb 84 id SERIAL PRIMARY KEY,
85 confirmed integer NOT NULL default '0',
86 deleted integer NOT NULL default '0',
87 username varchar(100) NOT NULL default '',
88 password varchar(32) NOT NULL default '',
89 idnumber varchar(12) default NULL,
90 firstname varchar(20) NOT NULL default '',
91 lastname varchar(20) NOT NULL default '',
92 email varchar(100) NOT NULL default '',
93 icq varchar(15) default NULL,
94 phone1 varchar(20) default NULL,
95 phone2 varchar(20) default NULL,
96 institution varchar(40) default NULL,
97 department varchar(30) default NULL,
98 address varchar(70) default NULL,
99 city varchar(20) default NULL,
100 country char(2) default NULL,
101 timezone float NOT NULL default '99',
102 firstaccess integer NOT NULL default '0',
103 lastaccess integer NOT NULL default '0',
104 lastlogin integer NOT NULL default '0',
105 currentlogin integer NOT NULL default '0',
106 lastIP varchar(15) default NULL,
107 secret varchar(15) default NULL,
108 picture integer default NULL,
109 url varchar(255) default NULL,
110 description text,
111 mailformat integer NOT NULL default '1',
112 maildisplay integer NOT NULL default '2',
113 timemodified integer NOT NULL default '0',
114 CONSTRAINT user_username_uk UNIQUE (username)
115);
116
a3eea09c 117CREATE TABLE prefix_user_admins (
fd790dfb 118 id SERIAL PRIMARY KEY,
ebc3bd2b 119 userid integer NOT NULL default '0'
fd790dfb 120);
121
a3eea09c 122CREATE TABLE prefix_user_students (
fd790dfb 123 id SERIAL PRIMARY KEY,
ebc3bd2b 124 userid integer NOT NULL default '0',
fd790dfb 125 course integer NOT NULL default '0',
ebc3bd2b 126 timestart integer NOT NULL default '0',
127 timeend integer NOT NULL default '0',
fd790dfb 128 time integer NOT NULL default '0'
129);
130
a3eea09c 131CREATE TABLE prefix_user_teachers (
fd790dfb 132 id SERIAL PRIMARY KEY,
ebc3bd2b 133 userid integer NOT NULL default '0',
fd790dfb 134 course integer NOT NULL default '0',
135 authority integer NOT NULL default '3',
136 role varchar(40) NOT NULL default ''
137);
a3eea09c 138
1924074c 139CREATE TABLE mdl_user_coursecreators (
140 id SERIAL8 PRIMARY KEY,
141 userid int8 NOT NULL default '0'
142);
a3eea09c 143
144INSERT INTO prefix_log_display VALUES ('user', 'view', 'user', 'CONCAT(firstname," ",lastname)');
db70b54b 145INSERT INTO prefix_log_display VALUES ('course', 'view', 'course', 'fullname');
146INSERT INTO prefix_log_display VALUES ('course', 'update', 'course', 'fullname');
147INSERT INTO prefix_log_display VALUES ('course', 'enrol', 'course', 'fullname');
148INSERT INTO prefix_log_display VALUES ('course', 'update', 'course', 'fullname');