ttrss_schema_pgsql.sql 21 KB

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