ttrss_schema_mysql.sql 23 KB

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