]> git.wh0rd.org - tt-rss.git/blame - schema/ttrss_schema_mysql.sql
feedbrowser hack
[tt-rss.git] / schema / ttrss_schema_mysql.sql
CommitLineData
84004f8c
AD
1SET NAMES utf8;
2SET CHARACTER SET utf8;
150b4a2c 3
889a5f9f 4drop table if exists ttrss_error_log;
5d9abb1e 5drop table if exists ttrss_plugin_storage;
58fa1bbc
AD
6drop table if exists ttrss_linked_feeds;
7drop table if exists ttrss_linked_instances;
8801fb01 8drop table if exists ttrss_access_keys;
f8bfb81f
AD
9drop table if exists ttrss_user_labels2;
10drop table if exists ttrss_labels2;
0c630ef3 11drop table if exists ttrss_feedbrowser_cache;
81dde650
AD
12drop table if exists ttrss_version;
13drop table if exists ttrss_labels;
6aff7845
AD
14drop table if exists ttrss_filters2_actions;
15drop table if exists ttrss_filters2_rules;
16drop table if exists ttrss_filters2;
5ddc7504 17drop table if exists ttrss_filters;
81dde650 18drop table if exists ttrss_filter_types;
53d6935b 19drop table if exists ttrss_filter_actions;
81dde650
AD
20drop table if exists ttrss_user_prefs;
21drop table if exists ttrss_prefs;
22drop table if exists ttrss_prefs_types;
58fa1bbc 23drop table if exists ttrss_prefs_sections;
eb36b4eb 24drop table if exists ttrss_tags;
963d3314 25drop table if exists ttrss_enclosures;
d9084cf2 26drop table if exists ttrss_settings_profiles;
8caa7999 27drop table if exists ttrss_entry_comments;
81dde650 28drop table if exists ttrss_user_entries;
648472a7 29drop table if exists ttrss_entries;
ab5eb26f 30drop table if exists ttrss_scheduled_updates;
4d736378 31drop table if exists ttrss_counters_cache;
8a4c759e 32drop table if exists ttrss_cat_counters_cache;
648472a7 33drop table if exists ttrss_feeds;
24902606 34drop table if exists ttrss_archived_feeds;
4a9a8bd8 35drop table if exists ttrss_feed_categories;
a6ccf566 36drop table if exists ttrss_users;
e552e5a2 37drop table if exists ttrss_themes;
36bfab86 38drop table if exists ttrss_sessions;
e552e5a2 39
855d0ecf
AD
40begin;
41
a6ccf566
AD
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,
f16ef236 45 last_login datetime default null,
e552e5a2 46 access_level integer not null default 0,
8629e09d 47 email varchar(250) not null default '',
73fe13af 48 full_name varchar(250) not null default '',
32be4b10
AD
49 email_digest bool not null default false,
50 last_digest_sent datetime default null,
e90053fe 51 salt varchar(250) not null default '',
54a3d3cf 52 created datetime default null,
57e24c82 53 twitter_oauth longtext default null,
fb70f26e 54 otp_enabled boolean not null default false,
532e1afe 55 resetpass_token varchar(250) default null) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
a6ccf566 56
58fa1bbc 57insert into ttrss_users (login,pwd_hash,access_level) values ('admin',
7f16656e 58 'SHA1:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', 10);
648472a7 59
17095c5a 60create table ttrss_feed_categories(id integer not null primary key auto_increment,
5a214f9d
AD
61 owner_uid integer not null,
62 title varchar(200) not null,
28bcadff 63 collapsed bool not null default false,
782ddd70 64 order_id integer not null default 0,
9432bfa0 65 parent_cat integer,
b4f83063 66 view_settings varchar(250) not null default '',
9432bfa0 67 foreign key (parent_cat) references ttrss_feed_categories(id) ON DELETE SET NULL,
7bfeaa17 68 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
4a9a8bd8 69
24902606
AD
70create table ttrss_archived_feeds (id integer not null primary key,
71 owner_uid integer not null,
58fa1bbc
AD
72 title varchar(200) not null,
73 feed_url text not null,
24902606 74 site_url varchar(250) not null default '',
7bfeaa17 75 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
24902606 76
4d736378
AD
77create table ttrss_counters_cache (
78 feed_id integer not null,
79 owner_uid integer not null,
80 value integer not null default 0,
a1eba24b 81 updated datetime not null,
8a4c759e 82 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE
4df07d50 83) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
8a4c759e 84
ed7f0ecd 85create index ttrss_counters_cache_feed_id_idx on ttrss_counters_cache(feed_id);
ed7f0ecd
AD
86create index ttrss_counters_cache_value_idx on ttrss_counters_cache(value);
87
8a4c759e
AD
88create 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,
4d736378 93 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE
4df07d50 94) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
4d736378 95
648472a7 96create table ttrss_feeds (id integer not null auto_increment primary key,
a6ccf566 97 owner_uid integer not null,
58fa1bbc 98 title varchar(200) not null,
4a9a8bd8 99 cat_id integer default null,
58fa1bbc 100 feed_url text not null,
648472a7 101 icon_url varchar(250) not null default '',
d148926e 102 update_interval integer not null default 0,
1089b16b 103 purge_interval integer not null default 0,
6497fb65 104 last_updated datetime default null,
ecd2e414 105 last_unconditional datetime default null,
0d276d67 106 last_error varchar(250) not null default '',
153cb6d3 107 last_modified varchar(250) not null default '',
14118af3 108 favicon_avg_color varchar(11) default null,
a6ccf566 109 site_url varchar(250) not null default '',
e93a3c96
AD
110 auth_login varchar(250) not null default '',
111 auth_pass varchar(250) not null default '',
de99f500 112 parent_feed integer default null,
5b35b4de 113 private bool not null default false,
70f6dbb1 114 rtl_content bool not null default false,
7da377ca 115 hidden bool not null default false,
3dd9183c 116 include_in_digest boolean not null default true,
fb67e2ba 117 cache_images boolean not null default false,
bfd61d3f 118 hide_images boolean not null default false,
87764a50 119 cache_content boolean not null default false,
155a2a53 120 auth_pass_encrypted boolean not null default false,
14fb4e91 121 last_viewed datetime default null,
3c50da83 122 last_update_started datetime default null,
e0382fd6 123 always_display_enclosures boolean not null default false,
5b8534ef 124 update_method integer not null default 0,
56781036 125 order_id integer not null default 0,
9382ca84 126 mark_unread_on_update boolean not null default false,
74b046a1 127 update_on_checksum_change boolean not null default false,
9382ca84 128 strip_images boolean not null default false,
b4f83063 129 view_settings varchar(250) not null default '',
5ab9791f 130 pubsub_state integer not null default 0,
382268c6 131 favicon_last_checked datetime default null,
df659891 132 feed_language varchar(100) not null default '',
4a9a8bd8 133 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE,
f0907182 134 foreign key (cat_id) references ttrss_feed_categories(id) ON DELETE SET NULL,
7bfeaa17 135 foreign key (parent_feed) references ttrss_feeds(id) ON DELETE SET NULL) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
a6ccf566 136
58fa1bbc 137insert into ttrss_feeds (owner_uid, title, feed_url) values
1f8c187d 138 (1, 'Tiny Tiny RSS: Forum', 'http://tt-rss.org/forum/rss.php');
648472a7 139
58fa1bbc
AD
140create table ttrss_entries (id integer not null primary key auto_increment,
141 title text not null,
142 guid varchar(255) not null unique,
143 link text not null,
144 updated datetime not null,
8e54a21e 145 content longtext not null,
648472a7 146 content_hash varchar(250) not null,
87764a50 147 cached_content longtext,
8158c57a 148 no_orig_date bool not null default 0,
c62d62f6 149 date_entered datetime not null,
25ea2805 150 date_updated datetime not null,
eb40e11b 151 num_comments integer not null default 0,
7bfb3dab 152 plugin_data longtext,
6b461797 153 lang varchar(2),
4bc760da 154 comments varchar(250) not null default '',
7bfeaa17 155 author varchar(250) not null default '') ENGINE=InnoDB DEFAULT CHARSET=UTF8;
c62d62f6 156
b60e1d86 157create index ttrss_entries_date_entered_index on ttrss_entries(date_entered);
ed7f0ecd 158create index ttrss_entries_updated_idx on ttrss_entries(updated);
b60e1d86 159
c62d62f6
AD
160create table ttrss_user_entries (
161 int_id integer not null primary key auto_increment,
162 ref_id integer not null,
83cd33fc 163 uuid varchar(200) not null,
58fa1bbc
AD
164 feed_id int,
165 orig_feed_id int,
c62d62f6
AD
166 owner_uid integer not null,
167 marked bool not null default 0,
ffba8297 168 published bool not null default 0,
490c366d 169 tag_cache text not null,
905ff52a 170 label_cache text not null,
c62d62f6 171 last_read datetime,
afb6038e 172 score int not null default 0,
8e54a21e 173 note longtext,
7873d588
AD
174 last_marked datetime,
175 last_published datetime,
1696229f 176 unread bool not null default 1,
c62d62f6 177 foreign key (ref_id) references ttrss_entries(id) ON DELETE CASCADE,
a6ccf566 178 foreign key (feed_id) references ttrss_feeds(id) ON DELETE CASCADE,
24902606 179 foreign key (orig_feed_id) references ttrss_archived_feeds(id) ON DELETE SET NULL,
7bfeaa17 180 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
648472a7 181
ed7f0ecd
AD
182create index ttrss_user_entries_unread_idx on ttrss_user_entries(unread);
183
8caa7999
AD
184create table ttrss_entry_comments (id integer not null primary key,
185 ref_id integer not null,
186 owner_uid integer not null,
187 private bool not null default 0,
188 date_entered datetime not null,
189 index (ref_id),
190 foreign key (ref_id) references ttrss_entries(id) ON DELETE CASCADE,
191 index (owner_uid),
7bfeaa17 192 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
8caa7999 193
58fa1bbc
AD
194create table ttrss_filter_types (id integer primary key,
195 name varchar(120) unique not null,
7bfeaa17 196 description varchar(250) not null unique) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
648472a7 197
648472a7
AD
198insert into ttrss_filter_types (id,name,description) values (1, 'title', 'Title');
199insert into ttrss_filter_types (id,name,description) values (2, 'content', 'Content');
58fa1bbc 200insert into ttrss_filter_types (id,name,description) values (3, 'both',
648472a7 201 'Title or Content');
58fa1bbc 202insert into ttrss_filter_types (id,name,description) values (4, 'link',
3a933f22 203 'Link');
58fa1bbc 204insert into ttrss_filter_types (id,name,description) values (5, 'date',
75fa1e31 205 'Article Date');
fa3317be 206insert into ttrss_filter_types (id,name,description) values (6, 'author', 'Author');
c3fc5e47 207insert into ttrss_filter_types (id,name,description) values (7, 'tag', 'Article Tags');
648472a7 208
58fa1bbc
AD
209create table ttrss_filter_actions (id integer not null primary key,
210 name varchar(120) unique not null,
7bfeaa17 211 description varchar(250) not null unique) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
53d6935b 212
58fa1bbc 213insert into ttrss_filter_actions (id,name,description) values (1, 'filter',
b9ad7cfa 214 'Delete article');
53d6935b 215
58fa1bbc 216insert into ttrss_filter_actions (id,name,description) values (2, 'catchup',
53d6935b
AD
217 'Mark as read');
218
58fa1bbc 219insert into ttrss_filter_actions (id,name,description) values (3, 'mark',
dd7d3187
AD
220 'Set starred');
221
58fa1bbc 222insert into ttrss_filter_actions (id,name,description) values (4, 'tag',
de07b5ee 223 'Assign tags');
7cb9311b 224
58fa1bbc 225insert into ttrss_filter_actions (id,name,description) values (5, 'publish',
0c4811be
AD
226 'Publish article');
227
58fa1bbc 228insert into ttrss_filter_actions (id,name,description) values (6, 'score',
fdb7b03f
AD
229 'Modify score');
230
58fa1bbc 231insert into ttrss_filter_actions (id,name,description) values (7, 'label',
ceb30ba4
AD
232 'Assign label');
233
5e736e45
AD
234insert into ttrss_filter_actions (id,name,description) values (8, 'stop',
235 'Stop / Do nothing');
236
b8774453
AD
237insert into ttrss_filter_actions (id,name,description) values (9, 'plugin',
238 'Invoke plugin');
239
6aff7845
AD
240create 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,
a3a896a1 244 inverse bool not null default false,
8e8c8934
AD
245 title varchar(250) not null default '',
246 order_id integer not null default 0,
6aff7845 247 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
fb70f26e 248
6aff7845
AD
249create table ttrss_filters2_rules(id integer primary key auto_increment,
250 filter_id integer not null references ttrss_filters2(id) on delete cascade,
2008ec4e 251 reg_exp text not null,
a3a896a1 252 inverse bool not null default false,
6aff7845
AD
253 filter_type integer not null,
254 feed_id integer default null,
255 cat_id integer default null,
256 cat_filter boolean not null default false,
10a1f28f 257 match_on text,
6aff7845
AD
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
267create 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
58fa1bbc
AD
276create table ttrss_tags (id integer primary key auto_increment,
277 owner_uid integer not null,
eb36b4eb 278 tag_name varchar(250) not null,
c62d62f6
AD
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,
a6ccf566 282 index (owner_uid),
7bfeaa17 283 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
eb36b4eb 284
7bfeaa17 285create table ttrss_version (schema_version int not null) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
5f171894 286
2008ec4e 287insert into ttrss_version values (134);
5f171894 288
d9084cf2 289create table ttrss_enclosures (id integer primary key auto_increment,
963d3314
AD
290 content_url text not null,
291 content_type varchar(250) not null,
292 post_id integer not null,
aa6d1e97 293 title text not null,
ce53e200 294 duration text not null,
06c4c9eb
FE
295 width integer not null default 0,
296 height integer not null default 0,
7bfeaa17 297 foreign key (post_id) references ttrss_entries(id) ON DELETE cascade) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
963d3314 298
d9084cf2
AD
299create 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),
7bfeaa17 303 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
d9084cf2 304
58fa1bbc 305create table ttrss_prefs_types (id integer not null primary key,
7bfeaa17 306 type_name varchar(100) not null) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
e0257be1
AD
307
308insert into ttrss_prefs_types (id, type_name) values (1, 'bool');
309insert into ttrss_prefs_types (id, type_name) values (2, 'string');
310insert into ttrss_prefs_types (id, type_name) values (3, 'integer');
311
58fa1bbc 312create table ttrss_prefs_sections (id integer not null primary key,
923b5c8b 313 order_id integer not null) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
e0257be1 314
923b5c8b
AD
315insert into ttrss_prefs_sections (id, order_id) values (1, 0);
316insert into ttrss_prefs_sections (id, order_id) values (2, 1);
317insert into ttrss_prefs_sections (id, order_id) values (3, 3);
318insert into ttrss_prefs_sections (id, order_id) values (4, 2);
e0257be1 319
a6ccf566 320create table ttrss_prefs (pref_name varchar(250) not null primary key,
e0257be1
AD
321 type_id integer not null,
322 section_id integer not null default 1,
2b6ed06b 323 access_level integer not null default 0,
e0257be1 324 def_value text not null,
e0257be1 325 foreign key (type_id) references ttrss_prefs_types(id),
7bfeaa17 326 foreign key (section_id) references ttrss_prefs_sections(id)) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
e0257be1 327
923b5c8b
AD
328insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('PURGE_OLD_DAYS', 3, '60', 1);
329insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('DEFAULT_UPDATE_INTERVAL', 3, '30', 1);
330insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('DEFAULT_ARTICLE_LIMIT', 3, '30', 2);
881a1580 331insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('ALLOW_DUPLICATE_POSTS', 1, 'false', 1);
923b5c8b
AD
332insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('ENABLE_FEED_CATS', 1, 'true', 2);
333insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('SHOW_CONTENT_PREVIEW', 1, 'true', 2);
334insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('SHORT_DATE_FORMAT', 2, 'M d, G:i', 3);
335insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('LONG_DATE_FORMAT', 2, 'D, M d Y - G:i', 3);
336insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('COMBINED_DISPLAY_MODE', 1, 'true', 2);
337insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('HIDE_READ_FEEDS', 1, 'false', 2);
338insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('ON_CATCHUP_SHOW_NEXT_FEED', 1, 'false', 2);
339insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('FEEDS_SORT_BY_UNREAD', 1, 'false', 2);
340insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('REVERSE_HEADLINES', 1, 'false', 2);
341insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('DIGEST_ENABLE', 1, 'false', 4);
342insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('CONFIRM_FEED_CATCHUP', 1, 'true', 2);
343insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('CDM_AUTO_CATCHUP', 1, 'false', 2);
344insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_DEFAULT_VIEW_MODE', 2, 'adaptive', 1);
345insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_DEFAULT_VIEW_LIMIT', 3, '30', 1);
346insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_PREFS_ACTIVE_TAB', 2, '', 1);
347insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('STRIP_UNSAFE_TAGS', 1, 'true', 3);
348insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('BLACKLISTED_TAGS', 2, 'main, generic, misc, uncategorized, blog, blogroll, general, news', 3);
349insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('FRESH_ARTICLE_MAX_AGE', 3, '24', 2);
350insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('DIGEST_CATCHUP', 1, 'false', 4);
351insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('CDM_EXPANDED', 1, 'true', 2);
352insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('PURGE_UNREAD_ARTICLES', 1, 'true', 3);
353insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('HIDE_READ_SHOWS_SPECIAL', 1, 'true', 2);
354insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('VFEED_GROUP_BY_FEED', 1, 'false', 2);
355insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('STRIP_IMAGES', 1, 'false', 2);
356insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_DEFAULT_VIEW_ORDER_BY', 2, 'default', 1);
357insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('ENABLE_API_ACCESS', 1, 'false', 1);
358insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_COLLAPSED_SPECIAL', 1, 'false', 1);
359insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_COLLAPSED_LABELS', 1, 'false', 1);
360insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_COLLAPSED_UNCAT', 1, 'false', 1);
361insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_COLLAPSED_FEEDLIST', 1, 'false', 1);
362insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_MOBILE_ENABLE_CATS', 1, 'false', 1);
363insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_MOBILE_SHOW_IMAGES', 1, 'false', 1);
364insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_MOBILE_HIDE_READ', 1, 'false', 1);
365insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_MOBILE_SORT_FEEDS_UNREAD', 1, 'false', 1);
366insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_THEME_ID', 2, '0', 1);
3fbb4d18 367insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('USER_TIMEZONE', 2, 'Automatic', 1);
923b5c8b
AD
368insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('USER_STYLESHEET', 2, '', 2);
369insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('SORT_HEADLINES_BY_FEED_DATE', 1, 'false', 2);
370insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_MOBILE_BROWSE_CATS', 1, 'true', 1);
371insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('SSL_CERT_SERIAL', 2, '', 3);
372insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('DIGEST_PREFERRED_TIME', 2, '00:00', 4);
373insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_PREFS_SHOW_EMPTY_CATS', 1, 'false', 1);
374insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_DEFAULT_INCLUDE_CHILDREN', 1, 'false', 1);
2457679a 375insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('AUTO_ASSIGN_LABELS', 1, 'false', 3);
923b5c8b
AD
376insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_ENABLED_PLUGINS', 2, '', 1);
377insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('_MOBILE_REVERSE_HEADLINES', 1, 'false', 1);
378insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('USER_CSS_THEME', 2, '', 2);
7b149552 379insert into ttrss_prefs (pref_name,type_id,def_value,section_id) values('USER_LANGUAGE', 2, '', 2);
5d40efc9 380
f9ebb32c
AD
381update ttrss_prefs set access_level = 1 where pref_name in ('ON_CATCHUP_SHOW_NEXT_FEED',
382 'SORT_HEADLINES_BY_FEED_DATE',
383 'VFEED_GROUP_BY_FEED',
384 'FRESH_ARTICLE_MAX_AGE',
385 'CDM_EXPANDED',
386 'SHOW_CONTENT_PREVIEW',
b24504b1 387 'AUTO_ASSIGN_LABELS',
f9ebb32c
AD
388 'HIDE_READ_SHOWS_SPECIAL');
389
a6ccf566
AD
390create table ttrss_user_prefs (
391 owner_uid integer not null,
392 pref_name varchar(250),
88e4e597 393 value longtext not null,
d9084cf2
AD
394 profile integer,
395 index (profile),
396 foreign key (profile) references ttrss_settings_profiles(id) ON DELETE CASCADE,
a6ccf566 397 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE,
7bfeaa17 398 foreign key (pref_name) references ttrss_prefs(pref_name) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
a6ccf566 399
bd40827b 400create table ttrss_sessions (id varchar(250) not null primary key,
36bfab86
AD
401 data text,
402 expire integer not null,
7bfeaa17 403 index (expire)) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
36bfab86 404
0c630ef3
AD
405create table ttrss_feedbrowser_cache (
406 feed_url text not null,
109662e1 407 site_url text not null,
931dcbc1 408 title text not null,
4df07d50 409 subscribers integer not null) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
0c630ef3 410
58fa1bbc 411create table ttrss_labels2 (id integer not null primary key auto_increment,
ceb30ba4
AD
412 owner_uid integer not null,
413 caption varchar(250) not null,
aec57d7a
AD
414 fg_color varchar(15) not null default '',
415 bg_color varchar(15) not null default '',
ceb30ba4 416 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE
7bfeaa17 417) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
ceb30ba4
AD
418
419create table ttrss_user_labels2 (label_id integer not null,
420 article_id integer not null,
421 foreign key (label_id) references ttrss_labels2(id) ON DELETE CASCADE,
422 foreign key (article_id) references ttrss_entries(id) ON DELETE CASCADE
7bfeaa17 423) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
ceb30ba4 424
58fa1bbc 425create table ttrss_access_keys (id integer not null primary key auto_increment,
8801fb01
AD
426 access_key varchar(250) not null,
427 feed_id varchar(250) not null,
428 is_cat bool not null default false,
429 owner_uid integer not null,
7bfeaa17 430 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
8801fb01 431
58fa1bbc 432create table ttrss_linked_instances (id integer not null primary key auto_increment,
afb875cc 433 last_connected datetime not null,
cfc06471
AD
434 last_status_in integer not null,
435 last_status_out integer not null,
1eb3012f 436 access_key varchar(250) not null unique,
7bfeaa17 437 access_url text not null) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
58fa1bbc
AD
438
439create table ttrss_linked_feeds (
440 feed_url text not null,
109662e1 441 site_url text not null,
58fa1bbc
AD
442 title text not null,
443 created datetime not null,
444 updated datetime not null,
445 instance_id integer not null,
446 subscribers integer not null,
7bfeaa17 447 foreign key (instance_id) references ttrss_linked_instances(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
58fa1bbc 448
5d9abb1e
AD
449create table ttrss_plugin_storage (
450 id integer not null auto_increment primary key,
451 name varchar(100) not null,
452 owner_uid integer not null,
453 content longtext not null,
454 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
455
889a5f9f
AD
456create table ttrss_error_log(
457 id integer not null auto_increment primary key,
458 owner_uid integer,
459 errno integer not null,
460 errstr text not null,
461 filename text not null,
3fbb4d18 462 lineno integer not null,
889a5f9f
AD
463 context text not null,
464 created_at datetime not null,
465 foreign key (owner_uid) references ttrss_users(id) ON DELETE SET NULL) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
5d9abb1e 466
855d0ecf 467commit;