ttrss_schema_mysql.sql 23 KB

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