]> git.wh0rd.org - tt-rss.git/blob - schema/ttrss_schema_mysql.sql
Merge pull request #432 from andersk/floating
[tt-rss.git] / schema / ttrss_schema_mysql.sql
1 SET NAMES utf8;
2 SET CHARACTER SET utf8;
3
4 drop table if exists ttrss_error_log;
5 drop table if exists ttrss_plugin_storage;
6 drop table if exists ttrss_linked_feeds;
7 drop table if exists ttrss_linked_instances;
8 drop table if exists ttrss_access_keys;
9 drop table if exists ttrss_user_labels2;
10 drop table if exists ttrss_labels2;
11 drop table if exists ttrss_feedbrowser_cache;
12 drop table if exists ttrss_version;
13 drop table if exists ttrss_labels;
14 drop table if exists ttrss_filters2_actions;
15 drop table if exists ttrss_filters2_rules;
16 drop table if exists ttrss_filters2;
17 drop table if exists ttrss_filters;
18 drop table if exists ttrss_filter_types;
19 drop table if exists ttrss_filter_actions;
20 drop table if exists ttrss_user_prefs;
21 drop table if exists ttrss_prefs;
22 drop table if exists ttrss_prefs_types;
23 drop table if exists ttrss_prefs_sections;
24 drop table if exists ttrss_tags;
25 drop table if exists ttrss_enclosures;
26 drop table if exists ttrss_settings_profiles;
27 drop table if exists ttrss_entry_comments;
28 drop table if exists ttrss_user_entries;
29 drop table if exists ttrss_entries;
30 drop table if exists ttrss_scheduled_updates;
31 drop table if exists ttrss_counters_cache;
32 drop table if exists ttrss_cat_counters_cache;
33 drop table if exists ttrss_feeds;
34 drop table if exists ttrss_archived_feeds;
35 drop table if exists ttrss_feed_categories;
36 drop table if exists ttrss_users;
37 drop table if exists ttrss_themes;
38 drop table if exists ttrss_sessions;
39
40 begin;
41
42 create table ttrss_users (id integer primary key not null auto_increment,
43 login varchar(120) not null unique,
44 pwd_hash varchar(250) not null,
45 last_login datetime default null,
46 access_level integer not null default 0,
47 email varchar(250) not null default '',
48 full_name varchar(250) not null default '',
49 email_digest bool not null default false,
50 last_digest_sent datetime default null,
51 salt varchar(250) not null default '',
52 created datetime default null,
53 twitter_oauth longtext default null,
54 otp_enabled boolean not null default false,
55 resetpass_token varchar(250) default null) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
56
57 insert into ttrss_users (login,pwd_hash,access_level) values ('admin',
58 'SHA1:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', 10);
59
60 create table ttrss_feed_categories(id integer not null primary key auto_increment,
61 owner_uid integer not null,
62 title varchar(200) not null,
63 collapsed bool not null default false,
64 order_id integer not null default 0,
65 parent_cat integer,
66 view_settings varchar(250) not null default '',
67 index(parent_cat),
68 foreign key (parent_cat) references ttrss_feed_categories(id) ON DELETE SET NULL,
69 index(owner_uid),
70 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
71
72 create table ttrss_archived_feeds (id integer not null primary key,
73 owner_uid integer not null,
74 title varchar(200) not null,
75 feed_url text not null,
76 site_url varchar(250) not null default '',
77 index(owner_uid),
78 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
79
80 create table ttrss_counters_cache (
81 feed_id integer not null,
82 owner_uid integer not null,
83 value integer not null default 0,
84 updated datetime not null,
85 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE
86 ) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
87
88 create index ttrss_counters_cache_feed_id_idx on ttrss_counters_cache(feed_id);
89 create index ttrss_counters_cache_owner_uid_idx on ttrss_counters_cache(owner_uid);
90 create index ttrss_counters_cache_value_idx on ttrss_counters_cache(value);
91
92 create table ttrss_cat_counters_cache (
93 feed_id integer not null,
94 owner_uid integer not null,
95 value integer not null default 0,
96 updated datetime not null,
97 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE
98 ) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
99
100 create index ttrss_cat_counters_cache_owner_uid_idx on ttrss_cat_counters_cache(owner_uid);
101
102 create table ttrss_feeds (id integer not null auto_increment primary key,
103 owner_uid integer not null,
104 title varchar(200) not null,
105 cat_id integer default null,
106 feed_url text not null,
107 icon_url varchar(250) not null default '',
108 update_interval integer not null default 0,
109 purge_interval integer not null default 0,
110 last_updated datetime default 0,
111 last_error varchar(250) not null default '',
112 favicon_avg_color varchar(11) default null,
113 site_url varchar(250) not null default '',
114 auth_login varchar(250) not null default '',
115 auth_pass varchar(250) not null default '',
116 parent_feed integer default null,
117 private bool not null default false,
118 rtl_content bool not null default false,
119 hidden bool not null default false,
120 include_in_digest boolean not null default true,
121 cache_images boolean not null default false,
122 hide_images boolean not null default false,
123 cache_content boolean not null default false,
124 auth_pass_encrypted boolean not null default false,
125 last_viewed datetime default null,
126 last_update_started datetime default null,
127 always_display_enclosures boolean not null default false,
128 update_method integer not null default 0,
129 order_id integer not null default 0,
130 mark_unread_on_update boolean not null default false,
131 update_on_checksum_change boolean not null default false,
132 strip_images boolean not null default false,
133 view_settings varchar(250) not null default '',
134 pubsub_state integer not null default 0,
135 favicon_last_checked datetime default null,
136 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE,
137 foreign key (cat_id) references ttrss_feed_categories(id) ON DELETE SET NULL,
138 index(parent_feed),
139 foreign key (parent_feed) references ttrss_feeds(id) ON DELETE SET NULL) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
140
141 create index ttrss_feeds_owner_uid_index on ttrss_feeds(owner_uid);
142 create index ttrss_feeds_cat_id_idx on ttrss_feeds(cat_id);
143
144 insert into ttrss_feeds (owner_uid, title, feed_url) values
145 (1, 'Tiny Tiny RSS: New Releases', 'http://tt-rss.org/releases.rss');
146
147 insert into ttrss_feeds (owner_uid, title, feed_url) values
148 (1, 'Tiny Tiny RSS: Forum', 'http://tt-rss.org/forum/rss.php');
149
150 create table ttrss_entries (id integer not null primary key auto_increment,
151 title text not null,
152 guid varchar(255) not null unique,
153 link text not null,
154 updated datetime not null,
155 content longtext not null,
156 content_hash varchar(250) not null,
157 cached_content longtext,
158 no_orig_date bool not null default 0,
159 date_entered datetime not null,
160 date_updated datetime not null,
161 num_comments integer not null default 0,
162 plugin_data longtext,
163 lang varchar(2),
164 comments varchar(250) not null default '',
165 author varchar(250) not null default '') ENGINE=InnoDB DEFAULT CHARSET=UTF8;
166
167 create index ttrss_entries_date_entered_index on ttrss_entries(date_entered);
168 create index ttrss_entries_updated_idx on ttrss_entries(updated);
169
170 create table ttrss_user_entries (
171 int_id integer not null primary key auto_increment,
172 ref_id integer not null,
173 uuid varchar(200) not null,
174 feed_id int,
175 orig_feed_id int,
176 owner_uid integer not null,
177 marked bool not null default 0,
178 published bool not null default 0,
179 tag_cache text not null,
180 label_cache text not null,
181 last_read datetime,
182 score int not null default 0,
183 note longtext,
184 last_marked datetime,
185 last_published datetime,
186 unread bool not null default 1,
187 foreign key (ref_id) references ttrss_entries(id) ON DELETE CASCADE,
188 foreign key (feed_id) references ttrss_feeds(id) ON DELETE CASCADE,
189 index (orig_feed_id),
190 foreign key (orig_feed_id) references ttrss_archived_feeds(id) ON DELETE SET NULL,
191 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
192
193 create index ttrss_user_entries_owner_uid_index on ttrss_user_entries(owner_uid);
194 create index ttrss_user_entries_ref_id_index on ttrss_user_entries(ref_id);
195 create index ttrss_user_entries_feed_id on ttrss_user_entries(feed_id);
196 create index ttrss_user_entries_unread_idx on ttrss_user_entries(unread);
197
198 create table ttrss_entry_comments (id integer not null primary key,
199 ref_id integer not null,
200 owner_uid integer not null,
201 private bool not null default 0,
202 date_entered datetime not null,
203 index (ref_id),
204 foreign key (ref_id) references ttrss_entries(id) ON DELETE CASCADE,
205 index (owner_uid),
206 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
207
208 create table ttrss_filter_types (id integer primary key,
209 name varchar(120) unique not null,
210 description varchar(250) not null unique) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
211
212 insert into ttrss_filter_types (id,name,description) values (1, 'title', 'Title');
213 insert into ttrss_filter_types (id,name,description) values (2, 'content', 'Content');
214 insert into ttrss_filter_types (id,name,description) values (3, 'both',
215 'Title or Content');
216 insert into ttrss_filter_types (id,name,description) values (4, 'link',
217 'Link');
218 insert into ttrss_filter_types (id,name,description) values (5, 'date',
219 'Article Date');
220 insert into ttrss_filter_types (id,name,description) values (6, 'author', 'Author');
221 insert into ttrss_filter_types (id,name,description) values (7, 'tag', 'Article Tags');
222
223 create table ttrss_filter_actions (id integer not null primary key,
224 name varchar(120) unique not null,
225 description varchar(250) not null unique) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
226
227 insert into ttrss_filter_actions (id,name,description) values (1, 'filter',
228 'Delete article');
229
230 insert into ttrss_filter_actions (id,name,description) values (2, 'catchup',
231 'Mark as read');
232
233 insert into ttrss_filter_actions (id,name,description) values (3, 'mark',
234 'Set starred');
235
236 insert into ttrss_filter_actions (id,name,description) values (4, 'tag',
237 'Assign tags');
238
239 insert into ttrss_filter_actions (id,name,description) values (5, 'publish',
240 'Publish article');
241
242 insert into ttrss_filter_actions (id,name,description) values (6, 'score',
243 'Modify score');
244
245 insert into ttrss_filter_actions (id,name,description) values (7, 'label',
246 'Assign label');
247
248 insert into ttrss_filter_actions (id,name,description) values (8, 'stop',
249 'Stop / Do nothing');
250
251 create table ttrss_filters2(id integer primary key auto_increment,
252 owner_uid integer not null,
253 match_any_rule boolean not null default false,
254 enabled boolean not null default true,
255 inverse bool not null default false,
256 title varchar(250) not null default '',
257 order_id integer not null default 0,
258 index(owner_uid),
259 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
260
261 create table ttrss_filters2_rules(id integer primary key auto_increment,
262 filter_id integer not null references ttrss_filters2(id) on delete cascade,
263 reg_exp varchar(250) not null,
264 inverse bool not null default false,
265 filter_type integer not null,
266 feed_id integer default null,
267 cat_id integer default null,
268 cat_filter boolean not null default false,
269 index (filter_id),
270 foreign key (filter_id) references ttrss_filters2(id) on delete cascade,
271 index (filter_type),
272 foreign key (filter_type) references ttrss_filter_types(id) ON DELETE CASCADE,
273 index (feed_id),
274 foreign key (feed_id) references ttrss_feeds(id) ON DELETE CASCADE,
275 index (cat_id),
276 foreign key (cat_id) references ttrss_feed_categories(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
277
278 create table ttrss_filters2_actions(id integer primary key auto_increment,
279 filter_id integer not null,
280 action_id integer not null default 1 references ttrss_filter_actions(id) on delete cascade,
281 action_param varchar(250) not null default '',
282 index (filter_id),
283 foreign key (filter_id) references ttrss_filters2(id) on delete cascade,
284 index (action_id),
285 foreign key (action_id) references ttrss_filter_actions(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
286
287 create table ttrss_tags (id integer primary key auto_increment,
288 owner_uid integer not null,
289 tag_name varchar(250) not null,
290 post_int_id integer not null,
291 index (post_int_id),
292 foreign key (post_int_id) references ttrss_user_entries(int_id) ON DELETE CASCADE,
293 index (owner_uid),
294 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
295
296 create table ttrss_version (schema_version int not null) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
297
298 insert into ttrss_version values (127);
299
300 create table ttrss_enclosures (id integer primary key auto_increment,
301 content_url text not null,
302 content_type varchar(250) not null,
303 post_id integer not null,
304 title text not null,
305 duration text not null,
306 width integer not null default 0,
307 height integer not null default 0,
308 foreign key (post_id) references ttrss_entries(id) ON DELETE cascade) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
309
310 create index ttrss_enclosures_post_id_idx on ttrss_enclosures(post_id);
311
312 create table ttrss_settings_profiles(id integer primary key auto_increment,
313 title varchar(250) not null,
314 owner_uid integer not null,
315 index (owner_uid),
316 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
317
318 create table ttrss_prefs_types (id integer not null primary key,
319 type_name varchar(100) not null) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
320
321 insert into ttrss_prefs_types (id, type_name) values (1, 'bool');
322 insert into ttrss_prefs_types (id, type_name) values (2, 'string');
323 insert into ttrss_prefs_types (id, type_name) values (3, 'integer');
324
325 create table ttrss_prefs_sections (id integer not null primary key,
326 order_id integer not null) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
327
328 insert into ttrss_prefs_sections (id, order_id) values (1, 0);
329 insert into ttrss_prefs_sections (id, order_id) values (2, 1);
330 insert into ttrss_prefs_sections (id, order_id) values (3, 3);
331 insert into ttrss_prefs_sections (id, order_id) values (4, 2);
332
333 create table ttrss_prefs (pref_name varchar(250) not null primary key,
334 type_id integer not null,
335 section_id integer not null default 1,
336 access_level integer not null default 0,
337 def_value text not null,
338 index(type_id),
339 foreign key (type_id) references ttrss_prefs_types(id),
340 index(section_id),
341 foreign key (section_id) references ttrss_prefs_sections(id)) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
342
343 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('PURGE_OLD_DAYS', 3, '60', 1);
344 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('DEFAULT_UPDATE_INTERVAL', 3, '30', 1);
345 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('DEFAULT_ARTICLE_LIMIT', 3, '30', 2);
346 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('ALLOW_DUPLICATE_POSTS', 1, 'false', 1);
347 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('ENABLE_FEED_CATS', 1, 'true', 2);
348 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('SHOW_CONTENT_PREVIEW', 1, 'true', 2);
349 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('SHORT_DATE_FORMAT', 2, 'M d, G:i', 3);
350 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('LONG_DATE_FORMAT', 2, 'D, M d Y - G:i', 3);
351 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('COMBINED_DISPLAY_MODE', 1, 'true', 2);
352 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('HIDE_READ_FEEDS', 1, 'false', 2);
353 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('ON_CATCHUP_SHOW_NEXT_FEED', 1, 'false', 2);
354 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('FEEDS_SORT_BY_UNREAD', 1, 'false', 2);
355 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('REVERSE_HEADLINES', 1, 'false', 2);
356 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('DIGEST_ENABLE', 1, 'false', 4);
357 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('CONFIRM_FEED_CATCHUP', 1, 'true', 2);
358 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('CDM_AUTO_CATCHUP', 1, 'false', 2);
359 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_DEFAULT_VIEW_MODE', 2, 'adaptive', 1);
360 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_DEFAULT_VIEW_LIMIT', 3, '30', 1);
361 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_PREFS_ACTIVE_TAB', 2, '', 1);
362 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('STRIP_UNSAFE_TAGS', 1, 'true', 3);
363 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('BLACKLISTED_TAGS', 2, 'main, generic, misc, uncategorized, blog, blogroll, general, news', 3);
364 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('FRESH_ARTICLE_MAX_AGE', 3, '24', 2);
365 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('DIGEST_CATCHUP', 1, 'false', 4);
366 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('CDM_EXPANDED', 1, 'true', 2);
367 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('PURGE_UNREAD_ARTICLES', 1, 'true', 3);
368 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('HIDE_READ_SHOWS_SPECIAL', 1, 'true', 2);
369 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('VFEED_GROUP_BY_FEED', 1, 'false', 2);
370 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('STRIP_IMAGES', 1, 'false', 2);
371 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_DEFAULT_VIEW_ORDER_BY', 2, 'default', 1);
372 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('ENABLE_API_ACCESS', 1, 'false', 1);
373 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_COLLAPSED_SPECIAL', 1, 'false', 1);
374 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_COLLAPSED_LABELS', 1, 'false', 1);
375 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_COLLAPSED_UNCAT', 1, 'false', 1);
376 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_COLLAPSED_FEEDLIST', 1, 'false', 1);
377 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_MOBILE_ENABLE_CATS', 1, 'false', 1);
378 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_MOBILE_SHOW_IMAGES', 1, 'false', 1);
379 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_MOBILE_HIDE_READ', 1, 'false', 1);
380 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_MOBILE_SORT_FEEDS_UNREAD', 1, 'false', 1);
381 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_THEME_ID', 2, '0', 1);
382 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('USER_TIMEZONE', 2, 'Automatic', 1);
383 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('USER_STYLESHEET', 2, '', 2);
384 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('SORT_HEADLINES_BY_FEED_DATE', 1, 'false', 2);
385 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_MOBILE_BROWSE_CATS', 1, 'true', 1);
386 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('SSL_CERT_SERIAL', 2, '', 3);
387 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('DIGEST_PREFERRED_TIME', 2, '00:00', 4);
388 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_PREFS_SHOW_EMPTY_CATS', 1, 'false', 1);
389 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_DEFAULT_INCLUDE_CHILDREN', 1, 'false', 1);
390 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('AUTO_ASSIGN_LABELS', 1, 'false', 3);
391 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_ENABLED_PLUGINS', 2, '', 1);
392 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_MOBILE_REVERSE_HEADLINES', 1, 'false', 1);
393 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('USER_CSS_THEME', 2, '', 2);
394 insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('USER_LANGUAGE', 2, '', 2);
395
396 update ttrss_prefs set access_level = 1 where pref_name in ('ON_CATCHUP_SHOW_NEXT_FEED',
397 'SORT_HEADLINES_BY_FEED_DATE',
398 'VFEED_GROUP_BY_FEED',
399 'FRESH_ARTICLE_MAX_AGE',
400 'CDM_EXPANDED',
401 'SHOW_CONTENT_PREVIEW',
402 'AUTO_ASSIGN_LABELS',
403 'HIDE_READ_SHOWS_SPECIAL');
404
405 create table ttrss_user_prefs (
406 owner_uid integer not null,
407 pref_name varchar(250),
408 value longtext not null,
409 profile integer,
410 index (profile),
411 foreign key (profile) references ttrss_settings_profiles(id) ON DELETE CASCADE,
412 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE,
413 foreign key (pref_name) references ttrss_prefs(pref_name) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
414
415 create index ttrss_user_prefs_owner_uid_index on ttrss_user_prefs(owner_uid);
416 create index ttrss_user_prefs_pref_name_idx on ttrss_user_prefs(pref_name);
417
418 create table ttrss_sessions (id varchar(250) not null primary key,
419 data text,
420 expire integer not null,
421 index (expire)) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
422
423 create table ttrss_feedbrowser_cache (
424 feed_url text not null,
425 site_url text not null,
426 title text not null,
427 subscribers integer not null) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
428
429 create table ttrss_labels2 (id integer not null primary key auto_increment,
430 owner_uid integer not null,
431 caption varchar(250) not null,
432 fg_color varchar(15) not null default '',
433 bg_color varchar(15) not null default '',
434 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE
435 ) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
436
437 create table ttrss_user_labels2 (label_id integer not null,
438 article_id integer not null,
439 foreign key (label_id) references ttrss_labels2(id) ON DELETE CASCADE,
440 foreign key (article_id) references ttrss_entries(id) ON DELETE CASCADE
441 ) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
442
443 create table ttrss_access_keys (id integer not null primary key auto_increment,
444 access_key varchar(250) not null,
445 feed_id varchar(250) not null,
446 is_cat bool not null default false,
447 owner_uid integer not null,
448 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
449
450 create table ttrss_linked_instances (id integer not null primary key auto_increment,
451 last_connected datetime not null,
452 last_status_in integer not null,
453 last_status_out integer not null,
454 access_key varchar(250) not null unique,
455 access_url text not null) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
456
457 create table ttrss_linked_feeds (
458 feed_url text not null,
459 site_url text not null,
460 title text not null,
461 created datetime not null,
462 updated datetime not null,
463 instance_id integer not null,
464 subscribers integer not null,
465 foreign key (instance_id) references ttrss_linked_instances(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
466
467 create table ttrss_plugin_storage (
468 id integer not null auto_increment primary key,
469 name varchar(100) not null,
470 owner_uid integer not null,
471 content longtext not null,
472 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
473
474 create table ttrss_error_log(
475 id integer not null auto_increment primary key,
476 owner_uid integer,
477 errno integer not null,
478 errstr text not null,
479 filename text not null,
480 lineno integer not null,
481 context text not null,
482 created_at datetime not null,
483 foreign key (owner_uid) references ttrss_users(id) ON DELETE SET NULL) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
484
485 commit;