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