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