db_schema.sql 7.42 KB
Newer Older
1
BEGIN TRANSACTION;
2
CREATE TABLE IF NOT EXISTS `accesslog` (
3
4
5
6
7
8
9
10
11
  `logfile` varchar(255) NOT NULL,
  `vhost` varchar(30) DEFAULT NULL,
  `path` varchar(255) NOT NULL,
  `timestamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `interval` INTEGER NOT NULL DEFAULT '0',
  `count` INTEGER NOT NULL DEFAULT '0',
  `volume` bigint(20) NOT NULL DEFAULT '0',
	PRIMARY KEY (logfile, path, timestamp)
);
12
CREATE TABLE IF NOT EXISTS `areas` (
13
14
15
16
17
18
  `area` varchar(20) NOT NULL PRIMARY KEY,
  `abbreviation` varchar(10) NOT NULL,
  `default` INTEGER NOT NULL DEFAULT '0',
  `rank` INTEGER DEFAULT NULL,
  `coordinates` varchar(30) NOT NULL
);
19
CREATE TABLE IF NOT EXISTS `changelog` (
20
21
22
23
24
25
26
27
28
29
30
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  `when` datetime NOT NULL,
  `who` INTEGER NOT NULL,
  `table` varchar(255) NOT NULL,
  `id_key` varchar(64) NOT NULL,
  `id_value` text NOT NULL,
  `field` varchar(255) NOT NULL,
  `value_old` text NOT NULL,
  `value_new` text NOT NULL,
  `executed` text NOT NULL
);
31
32
33
34
35
36
37
38
39
40
41
42
CREATE TABLE IF NOT EXISTS `chapters` (
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  `lecture_id` INTEGER NOT NULL,
	`time` INTEGER NOT NULL,
	`text` text NOT NULL,
	`visible` INTEGER NOT NULL DEFAULT 0,
	`deleted` INTEGER NOT NULL DEFAULT 0,
	`time_created` datetime NOT NULL,
	`time_updated` datetime NOT NULL,
	`created_by` INTEGER DEFAULT NULL,
	`submitted_by` varchar(32) DEFAULT NULL
);
43
CREATE TABLE IF NOT EXISTS `courses_data` (
44
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
Julian Rother's avatar
Julian Rother committed
45
  `visible` INTEGER NOT NULL DEFAULT '0',
46
47
  `listed` INTEGER NOT NULL DEFAULT '1',
  `deleted` INTEGER NOT NULL DEFAULT '0',
48
  `title` text NOT NULL DEFAULT '',
Julian Rother's avatar
Julian Rother committed
49
50
51
52
  `short` varchar(32) NOT NULL DEFAULT '',
  `handle` varchar(32) NOT NULL DEFAULT '',
  `organizer` text NOT NULL DEFAULT '',
  `subject` varchar(32) NOT NULL DEFAULT '',
53
54
55
56
  `credits` INTEGER NOT NULL DEFAULT '0',
  `created_by` INTEGER DEFAULT NULL,
  `time_created` datetime NOT NULL,
  `time_updated` datetime NOT NULL,
Julian Rother's avatar
Julian Rother committed
57
58
  `semester` char(6) NOT NULL DEFAULT '',
  `settings` text NOT NULL DEFAULT '',
59
60
  `downloadable` INTEGER NOT NULL DEFAULT '1',
  `embedinvisible` INTEGER NOT NULL DEFAULT '0',
Julian Rother's avatar
Julian Rother committed
61
62
63
64
  `description` text NOT NULL DEFAULT '',
  `internal` text NOT NULL DEFAULT '',
  `responsible` text NOT NULL DEFAULT '',
  `feed_url` text NOT NULL DEFAULT ''
65
);
66
CREATE TABLE IF NOT EXISTS `filesizes` (
67
68
69
70
71
  `path` varchar(255) NOT NULL PRIMARY KEY,
  `size` bigint(20) NOT NULL DEFAULT '0',
  `duration` float DEFAULT NULL,
  `basename` varchar(255) NOT NULL
);
72
CREATE TABLE IF NOT EXISTS `formats` (
73
74
75
76
77
78
79
80
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  `description` text NOT NULL,
  `keywords` text NOT NULL,
  `resolution` varchar(16) NOT NULL,
  `aspect` varchar(16) NOT NULL,
  `prio` INTEGER NOT NULL DEFAULT '0',
  `player_prio` INTEGER NOT NULL DEFAULT '0'
);
81
CREATE TABLE IF NOT EXISTS `lectures_data` (
82
83
84
85
86
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  `course_id` INTEGER NOT NULL,
  `visible` INTEGER NOT NULL DEFAULT '1',
  `timed_release` datetime DEFAULT NULL,
  `use_timed_release` INTEGER NOT NULL DEFAULT '0',
87
  `drehplan` varchar(10) NOT NULL DEFAULT '',
88
  `deleted` INTEGER NOT NULL DEFAULT '0',
89
90
91
92
93
  `title` text NOT NULL DEFAULT '',
  `comment` text NOT NULL DEFAULT '',
  `internal` text NOT NULL DEFAULT '',
  `speaker` text NOT NULL DEFAULT '',
  `place` text NOT NULL DEFAULT '',
94
95
96
97
  `time` datetime NOT NULL,
  `duration` INTEGER NOT NULL DEFAULT '90',
  `time_created` datetime NOT NULL,
  `time_updated` datetime NOT NULL,
98
99
  `jumplist` text NOT NULL DEFAULT '',
  `titlefile` varchar(255) NOT NULL DEFAULT ''
100
);
101
CREATE TABLE IF NOT EXISTS `places` (
102
103
104
105
106
107
  `place` varchar(20) NOT NULL PRIMARY KEY,
  `name` text NOT NULL,
  `area` varchar(20) NOT NULL,
  `campus_room` varchar(20) NOT NULL,
  `campus_name` varchar(30) NOT NULL
);
108
109
110
111
112
CREATE TABLE IF NOT EXISTS `auth` (
	`auth_id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	`course_id` INTEGER,
	`lecture_id` INTEGER,
	`video_id` INTEGER,
113
	`auth_type` varchar(10),
114
115
116
	`auth_user` varchar(127),
	`auth_passwd` varchar(127)
);
117
CREATE TABLE IF NOT EXISTS `site_texts` (
118
119
120
121
122
  `key` varchar(64) NOT NULL PRIMARY KEY,
  `value` text NOT NULL,
  `modified_when` datetime NOT NULL,
  `modified_by` text NOT NULL
);
123
124
125
126
127
128
CREATE TABLE IF NOT EXISTS `log` (
	`ip` varchar(64),
	`id` varchar(64),
	`time` datetime NOT NULL,
	`object` varchar(10),
	`obj_id` INTEGER,
129
	`path` varchar(255) NOT NULL
130
);
131
CREATE TABLE IF NOT EXISTS `streams` (
132
133
134
135
136
137
138
  `handle` varchar(32) NOT NULL PRIMARY KEY,
  `active` INTEGER NOT NULL,
  `visible` INTEGER NOT NULL,
  `lecture_id` INTEGER NOT NULL,
  `description` text NOT NULL,
  `poster` text NOT NULL
);
139
CREATE TABLE IF NOT EXISTS `stream_stats` (
140
141
142
143
144
145
146
147
148
149
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  `handle` varchar(32) NOT NULL,
  `lecture` INTEGER NOT NULL,
  `time` datetime NOT NULL,
  `rtmp_h264` INTEGER NOT NULL DEFAULT '0',
  `http_webm` INTEGER NOT NULL DEFAULT '0',
  `hls_1080p` INTEGER NOT NULL DEFAULT '0',
  `hls_720p` INTEGER NOT NULL DEFAULT '0',
  `hls_360p` INTEGER NOT NULL DEFAULT '0'
);
Andreas Valder's avatar
Andreas Valder committed
150
151
152
153
154
155
156
157
CREATE TABLE IF NOT EXISTS `import_campus` (
	`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	`course_id` INTEGER NOT NULL,
	`last_checked` datetime NOT NULL,
	`type` varchar(255),
	`url` varchar(2084),
	`changed` INTEGER NOT NULL DEFAULT '0' 
);
158
CREATE TABLE IF NOT EXISTS `users` (
159
160
161
162
163
164
165
166
167
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  `name` varchar(32) NOT NULL,
  `realname` text NOT NULL,
  `level` INTEGER NOT NULL DEFAULT '0',
  `fsacc` varchar(32) NOT NULL,
  `last_login` datetime DEFAULT NULL,
  `calendar_key` varchar(40) NOT NULL,
  `rfc6238` varchar(20) NOT NULL
);
168
CREATE TABLE IF NOT EXISTS `videos_data` (
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  `lecture_id` INTEGER NOT NULL,
  `visible` INTEGER NOT NULL DEFAULT '1',
  `deleted` INTEGER NOT NULL DEFAULT '0',
  `downloadable` INTEGER NOT NULL DEFAULT '1',
  `title` text NOT NULL,
  `comment` text NOT NULL,
  `internal` text NOT NULL,
  `path` text NOT NULL,
  `file_modified` datetime NOT NULL,
  `time_created` datetime NOT NULL,
  `time_updated` datetime NOT NULL,
  `created_by` INTEGER NOT NULL,
  `file_size` bigINTEGER NOT NULL DEFAULT '-1',
  `video_format` INTEGER NOT NULL,
  `hash` varchar(32) NOT NULL
);
186
187
CREATE TABLE IF NOT EXISTS `announcements` (
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
188
	`extid` varchar(128) UNIQUE,
189
	`text` text NOT NULL DEFAULT '',
190
191
192
	`level` INTEGER NOT NULL DEFAULT 0,
	`visible` INTEGER NOT NULL DEFAULT 0,
	`deleted` INTEGER NOT NULL DEFAULT 0,
193
194
  `time_publish` datetime DEFAULT "",
  `time_expire` datetime DEFAULT "",
195
196
197
198
  `time_created` datetime NOT NULL,
  `time_updated` datetime NOT NULL,
  `created_by` INTEGER NOT NULL
);
199
200
CREATE TABLE IF NOT EXISTS `featured` (
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
201
	`title` text NOT NULL DEFAULT '',
202
203
204
205
206
207
208
209
	`text` text NOT NULL DEFAULT "",
	`internal` text NOT NULL DEFAULT "",
	`visible` INTEGER NOT NULL DEFAULT 0,
	`deleted` INTEGER NOT NULL DEFAULT 0,
  `time_created` datetime NOT NULL,
  `time_updated` datetime NOT NULL,
  `created_by` INTEGER NOT NULL
);
210
211
212
213
214
215
216
217
CREATE TABLE IF NOT EXISTS `sortlog` (
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  `when` datetime NOT NULL,
  `path` text NOT NULL,
  `lecture_id` INTEGER NOT NULL,
  `video_id` INTEGER NOT NULL
);

218
219
220
CREATE VIEW IF NOT EXISTS `courses` AS select * from `courses_data` where (not(`courses_data`.`deleted`));
CREATE VIEW IF NOT EXISTS `lectures` AS select * from `lectures_data` where (not(`lectures_data`.`deleted`));
CREATE VIEW IF NOT EXISTS `videos` AS select * from `videos_data` where (not(`videos_data`.`deleted`));
221
COMMIT;