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