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