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