1 drop table if exists ttrss_plugin_storage
;
2 drop table if exists ttrss_linked_feeds
;
3 drop table if exists ttrss_linked_instances
;
4 drop table if exists ttrss_access_keys
;
5 drop table if exists ttrss_user_labels2
;
6 drop table if exists ttrss_labels2
;
7 drop table if exists ttrss_feedbrowser_cache
;
8 drop table if exists ttrss_version
;
9 drop table if exists ttrss_labels
;
10 drop table if exists ttrss_filters2_rules
;
11 drop table if exists ttrss_filters2_actions
;
12 drop table if exists ttrss_filters2
;
13 drop table if exists ttrss_filters
;
14 drop table if exists ttrss_filter_types
;
15 drop table if exists ttrss_filter_actions
;
16 drop table if exists ttrss_user_prefs
;
17 drop table if exists ttrss_prefs
;
18 drop table if exists ttrss_prefs_types
;
19 drop table if exists ttrss_prefs_sections
;
20 drop table if exists ttrss_tags
;
21 drop table if exists ttrss_enclosures
;
22 drop table if exists ttrss_settings_profiles
;
23 drop table if exists ttrss_entry_comments
;
24 drop table if exists ttrss_user_entries
;
25 drop table if exists ttrss_entries
;
26 drop table if exists ttrss_scheduled_updates
;
27 drop table if exists ttrss_counters_cache
;
28 drop table if exists ttrss_cat_counters_cache
;
29 drop table if exists ttrss_archived_feeds
;
30 drop table if exists ttrss_feeds
;
31 drop table if exists ttrss_feed_categories
;
32 drop table if exists ttrss_users
;
33 drop table if exists ttrss_themes
;
34 drop table if exists ttrss_sessions
;
35 drop function if exists SUBSTRING_FOR_DATE(timestamp, int, int);
39 create table ttrss_users (id serial
not null primary key,
40 login varchar(120) not null unique,
41 pwd_hash
varchar(250) not null,
42 last_login
timestamp default null,
43 access_level
integer not null default 0,
44 email
varchar(250) not null default '',
45 full_name
varchar(250) not null default '',
46 email_digest
boolean not null default false,
47 last_digest_sent
timestamp default null,
48 salt
varchar(250) not null default '',
49 twitter_oauth
text default null,
50 otp_enabled
boolean not null default false,
51 created
timestamp default null);
53 insert into ttrss_users (login,pwd_hash
,access_level
) values ('admin',
54 'SHA1:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', 10);
56 create table ttrss_feed_categories(id serial
not null primary key,
57 owner_uid
integer not null references ttrss_users(id) on delete cascade,
58 collapsed
boolean not null default false,
59 order_id
integer not null default 0,
60 parent_cat
integer references ttrss_feed_categories(id) on delete set null,
61 title
varchar(200) not null);
63 create table ttrss_feeds (id serial
not null primary key,
64 owner_uid
integer not null references ttrss_users(id) on delete cascade,
65 title
varchar(200) not null,
66 cat_id
integer default null references ttrss_feed_categories(id) on delete set null,
67 feed_url
text not null,
68 icon_url
varchar(250) not null default '',
69 update_interval
integer not null default 0,
70 purge_interval
integer not null default 0,
71 last_updated
timestamp default null,
72 last_error
text not null default '',
73 site_url
varchar(250) not null default '',
74 auth_login
varchar(250) not null default '',
75 parent_feed
integer default null references ttrss_feeds(id) on delete set null,
76 private
boolean not null default false,
77 auth_pass
varchar(250) not null default '',
78 hidden
boolean not null default false,
79 include_in_digest
boolean not null default true,
80 rtl_content
boolean not null default false,
81 cache_images
boolean not null default false,
82 hide_images
boolean not null default false,
83 cache_content
boolean not null default false,
84 last_viewed
timestamp default null,
85 last_update_started
timestamp default null,
86 update_method
integer not null default 0,
87 always_display_enclosures
boolean not null default false,
88 order_id
integer not null default 0,
89 mark_unread_on_update
boolean not null default false,
90 update_on_checksum_change
boolean not null default false,
91 strip_images
boolean not null default false,
92 pubsub_state
integer not null default 0,
93 favicon_last_checked
timestamp default null,
94 auth_pass_encrypted
boolean not null default false);
96 create index ttrss_feeds_owner_uid_index
on ttrss_feeds(owner_uid
);
97 create index ttrss_feeds_cat_id_idx
on ttrss_feeds(cat_id
);
99 insert into ttrss_feeds (owner_uid
, title
, feed_url
) values
100 (1, 'Tiny Tiny RSS: New Releases', 'http://tt-rss.org/releases.rss');
102 insert into ttrss_feeds (owner_uid
, title
, feed_url
) values
103 (1, 'Tiny Tiny RSS: Forum', 'http://tt-rss.org/forum/rss.php');
105 create table ttrss_archived_feeds (id integer not null primary key,
106 owner_uid
integer not null references ttrss_users(id) on delete cascade,
107 title
varchar(200) not null,
108 feed_url
text not null,
109 site_url
varchar(250) not null default '');
111 create table ttrss_counters_cache (
112 feed_id
integer not null,
113 owner_uid
integer not null references ttrss_users(id) ON DELETE CASCADE,
114 updated
timestamp not null,
115 value integer not null default 0);
117 create index ttrss_counters_cache_feed_id_idx
on ttrss_counters_cache(feed_id
);
118 create index ttrss_counters_cache_owner_uid_idx
on ttrss_counters_cache(owner_uid
);
119 create index ttrss_counters_cache_value_idx
on ttrss_counters_cache(value);
121 create table ttrss_cat_counters_cache (
122 feed_id
integer not null,
123 owner_uid
integer not null references ttrss_users(id) ON DELETE CASCADE,
124 updated
timestamp not null,
125 value integer not null default 0);
127 create index ttrss_cat_counters_cache_owner_uid_idx
on ttrss_cat_counters_cache(owner_uid
);
129 create table ttrss_entries (id serial
not null primary key,
131 guid
text not null unique,
133 updated
timestamp not null,
134 content text not null,
135 content_hash
varchar(250) not null,
137 no_orig_date
boolean not null default false,
138 date_entered
timestamp not null,
139 date_updated
timestamp not null,
140 num_comments
integer not null default 0,
141 comments varchar(250) not null default '',
143 author
varchar(250) not null default '');
145 create index ttrss_entries_guid_index
on ttrss_entries(guid
);
146 -- create index ttrss_entries_title_index on ttrss_entries(title);
147 create index ttrss_entries_date_entered_index
on ttrss_entries(date_entered
);
148 create index ttrss_entries_updated_idx
on ttrss_entries(updated
);
150 create table ttrss_user_entries (
151 int_id serial
not null primary key,
152 ref_id
integer not null references ttrss_entries(id) ON DELETE CASCADE,
153 uuid
varchar(200) not null,
154 feed_id
int references ttrss_feeds(id) ON DELETE CASCADE,
155 orig_feed_id
integer references ttrss_archived_feeds(id) ON DELETE SET NULL,
156 owner_uid
integer not null references ttrss_users(id) ON DELETE CASCADE,
157 marked
boolean not null default false,
158 published
boolean not null default false,
159 tag_cache
text not null,
160 label_cache
text not null,
162 score
int not null default 0,
163 last_marked
timestamp,
164 last_published
timestamp,
166 unread
boolean not null default true);
168 -- create index ttrss_user_entries_feed_id_index on ttrss_user_entries(feed_id);
169 create index ttrss_user_entries_owner_uid_index
on ttrss_user_entries(owner_uid
);
170 create index ttrss_user_entries_ref_id_index
on ttrss_user_entries(ref_id
);
171 create index ttrss_user_entries_feed_id
on ttrss_user_entries(feed_id
);
172 create index ttrss_user_entries_unread_idx
on ttrss_user_entries(unread
);
174 create table ttrss_entry_comments (id serial
not null primary key,
175 ref_id
integer not null references ttrss_entries(id) ON DELETE CASCADE,
176 owner_uid
integer not null references ttrss_users(id) ON DELETE CASCADE,
177 private
boolean not null default false,
178 date_entered
timestamp not null);
180 create index ttrss_entry_comments_ref_id_index
on ttrss_entry_comments(ref_id
);
181 -- create index ttrss_entry_comments_owner_uid_index on ttrss_entry_comments(owner_uid);
183 create table ttrss_filter_types (id integer not null primary key,
184 name varchar(120) unique not null,
185 description
varchar(250) not null unique);
187 insert into ttrss_filter_types (id,name,description
) values (1, 'title', 'Title');
188 insert into ttrss_filter_types (id,name,description
) values (2, 'content', 'Content');
189 insert into ttrss_filter_types (id,name,description
) values (3, 'both',
191 insert into ttrss_filter_types (id,name,description
) values (4, 'link',
193 insert into ttrss_filter_types (id,name,description
) values (5, 'date',
195 insert into ttrss_filter_types (id,name,description
) values (6, 'author', 'Author');
196 insert into ttrss_filter_types (id,name,description
) values (7, 'tag', 'Article Tags');
198 create table ttrss_filter_actions (id integer not null primary key,
199 name varchar(120) unique not null,
200 description
varchar(250) not null unique);
202 insert into ttrss_filter_actions (id,name,description
) values (1, 'filter',
205 insert into ttrss_filter_actions (id,name,description
) values (2, 'catchup',
208 insert into ttrss_filter_actions (id,name,description
) values (3, 'mark',
211 insert into ttrss_filter_actions (id,name,description
) values (4, 'tag',
214 insert into ttrss_filter_actions (id,name,description
) values (5, 'publish',
217 insert into ttrss_filter_actions (id,name,description
) values (6, 'score',
220 insert into ttrss_filter_actions (id,name,description
) values (7, 'label',
223 create table ttrss_filters (id serial
not null primary key,
224 owner_uid
integer not null references ttrss_users(id) on delete cascade,
225 feed_id
integer references ttrss_feeds(id) on delete cascade default null,
226 filter_type
integer not null references ttrss_filter_types(id),
227 reg_exp
varchar(250) not null,
228 filter_param
varchar(250) not null default '',
229 enabled
boolean not null default true,
230 inverse
boolean not null default false,
231 cat_filter
boolean not null default false,
232 cat_id
integer references ttrss_feed_categories(id) on delete cascade default null,
233 action_id
integer not null default 1 references ttrss_filter_actions(id) on delete cascade,
234 action_param
varchar(250) not null default '');
236 create table ttrss_filters2(id serial
not null primary key,
237 owner_uid
integer not null references ttrss_users(id) on delete cascade,
238 match_any_rule
boolean not null default false,
239 inverse
boolean not null default false,
240 enabled
boolean not null default true);
242 create table ttrss_filters2_rules(id serial
not null primary key,
243 filter_id
integer not null references ttrss_filters2(id) on delete cascade,
244 reg_exp
varchar(250) not null,
245 inverse
boolean not null default false,
246 filter_type
integer not null references ttrss_filter_types(id),
247 feed_id
integer references ttrss_feeds(id) on delete cascade default null,
248 cat_id
integer references ttrss_feed_categories(id) on delete cascade default null,
249 cat_filter
boolean not null default false);
251 create table ttrss_filters2_actions(id serial
not null primary key,
252 filter_id
integer not null references ttrss_filters2(id) on delete cascade,
253 action_id
integer not null default 1 references ttrss_filter_actions(id) on delete cascade,
254 action_param
varchar(250) not null default '');
256 create table ttrss_tags (id serial
not null primary key,
257 tag_name
varchar(250) not null,
258 owner_uid
integer not null references ttrss_users(id) on delete cascade,
259 post_int_id
integer references ttrss_user_entries(int_id
) ON DELETE CASCADE not null);
261 create index ttrss_tags_owner_uid_index
on ttrss_tags(owner_uid
);
262 create index ttrss_tags_post_int_id_idx
on ttrss_tags(post_int_id
);
264 create table ttrss_version (schema_version
int not null);
266 insert into ttrss_version
values (107);
268 create table ttrss_enclosures (id serial
not null primary key,
269 content_url
text not null,
270 content_type
varchar(250) not null,
272 duration
text not null,
273 post_id
integer references ttrss_entries(id) ON DELETE cascade NOT NULL);
275 create index ttrss_enclosures_post_id_idx
on ttrss_enclosures(post_id
);
277 create table ttrss_settings_profiles(id serial
not null primary key,
278 title
varchar(250) not null,
279 owner_uid
integer not null references ttrss_users(id) on delete cascade);
281 create table ttrss_prefs_types (id integer not null primary key,
282 type_name
varchar(100) not null);
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');
288 create table ttrss_prefs_sections (id integer not null primary key,
289 order_id
integer not null,
290 section_name
varchar(100) not null);
292 insert into ttrss_prefs_sections (id, section_name
, order_id
) values (1, 'General', 0);
293 insert into ttrss_prefs_sections (id, section_name
, order_id
) values (2, 'Interface', 1);
294 insert into ttrss_prefs_sections (id, section_name
, order_id
) values (3, 'Advanced', 3);
295 insert into ttrss_prefs_sections (id, section_name
, order_id
) values (4, 'Digest', 2);
297 create table ttrss_prefs (pref_name
varchar(250) not null primary key,
298 type_id
integer not null references ttrss_prefs_types(id),
299 section_id
integer not null default 1 references ttrss_prefs_sections(id),
300 short_desc
text not null,
301 help_text
varchar(250) not null default '',
302 access_level
integer not null default 0,
303 def_value
text not null);
305 create index ttrss_prefs_pref_name_idx
on ttrss_prefs(pref_name
);
307 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('PURGE_OLD_DAYS', 3, '60', 'Purge articles after this number of days (0 - disables)',1);
309 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('DEFAULT_UPDATE_INTERVAL', 3, '30', 'Default interval between feed updates',1);
311 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('DEFAULT_ARTICLE_LIMIT', 3, '30', 'Amount of articles to display at once',2);
313 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
,help_text
) values('ALLOW_DUPLICATE_POSTS', 1, 'true', 'Allow duplicate posts',1, 'This option is useful when you are reading several planet-type aggregators with partially colliding userbase. When disabled, it forces same posts from different feeds to appear only once.');
315 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('ENABLE_FEED_CATS', 1, 'true', 'Enable feed categories',2);
317 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('SHOW_CONTENT_PREVIEW', 1, 'true', 'Show content preview in headlines list',2);
319 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('SHORT_DATE_FORMAT', 2, 'M d, G:i', 'Short date format',3);
320 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('LONG_DATE_FORMAT', 2, 'D, M d Y - G:i', 'Long date format',3);
322 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
,help_text
) values('COMBINED_DISPLAY_MODE', 1, 'false', 'Combined feed display',2, 'Display expanded list of feed articles, instead of separate displays for headlines and article content');
324 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('HIDE_READ_FEEDS', 1, 'false', 'Hide feeds with no unread messages',2);
326 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
,help_text
) values('ON_CATCHUP_SHOW_NEXT_FEED', 1, 'false', 'On catchup show next feed',2, 'Automatically open next feed with unread articles after marking one as read');
328 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('FEEDS_SORT_BY_UNREAD', 1, 'false', 'Sort feeds by unread articles count',2);
330 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('REVERSE_HEADLINES', 1, 'false', 'Reverse headline order (oldest first)',2);
332 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
,help_text
) values('DIGEST_ENABLE', 1, 'false', 'Enable e-mail digest',4, 'This option enables sending daily digest of new (and unread) headlines on your configured e-mail address');
334 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('CONFIRM_FEED_CATCHUP', 1, 'true', 'Confirm marking feed as read',2);
336 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
,help_text
) values('CDM_AUTO_CATCHUP', 1, 'false', 'Automatically mark articles as read',2, 'This option enables marking articles as read automatically while you scroll article list.');
338 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('_DEFAULT_VIEW_MODE', 2, 'adaptive', '', 1);
340 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('_DEFAULT_VIEW_LIMIT', 3, '30', '', 1);
342 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('_PREFS_ACTIVE_TAB', 2, '', '', 1);
344 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
,help_text
) values('STRIP_UNSAFE_TAGS', 1, 'true', 'Strip unsafe tags from articles', 3, 'Strip all but most common HTML tags when reading articles.');
346 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
,help_text
) values('BLACKLISTED_TAGS', 2, 'main, generic, misc, uncategorized, blog, blogroll, general, news', 'Blacklisted tags', 3, 'When auto-detecting tags in articles these tags will not be applied (comma-separated list).');
348 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('FRESH_ARTICLE_MAX_AGE', 3, '24', 'Maximum age of fresh articles (in hours)',2);
350 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('DIGEST_CATCHUP', 1, 'false', 'Mark articles in e-mail digest as read',4);
352 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('CDM_EXPANDED', 1, 'true', 'Automatically expand articles in combined mode',2);
354 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('PURGE_UNREAD_ARTICLES', 1, 'true', 'Purge unread articles',3);
356 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('HIDE_READ_SHOWS_SPECIAL', 1, 'true', 'Show special feeds when hiding read feeds',2);
358 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
,help_text
) values('VFEED_GROUP_BY_FEED', 1, 'false', 'Group headlines in virtual feeds',2, 'When this option is enabled, headlines in Special feeds and Labels are grouped by feeds');
360 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('STRIP_IMAGES', 1, 'false', 'Do not embed images in articles', 2);
362 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('_DEFAULT_VIEW_ORDER_BY', 2, 'default', '', 1);
364 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('ENABLE_API_ACCESS', 1, 'false', 'Enable external API', 1);
366 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('_COLLAPSED_SPECIAL', 1, 'false', '', 1);
368 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('_COLLAPSED_LABELS', 1, 'false', '', 1);
370 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('_COLLAPSED_UNCAT', 1, 'false', '', 1);
372 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('_COLLAPSED_FEEDLIST', 1, 'false', '', 1);
374 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('_MOBILE_ENABLE_CATS', 1, 'false', '', 1);
376 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('_MOBILE_SHOW_IMAGES', 1, 'false', '', 1);
378 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('_MOBILE_HIDE_READ', 1, 'false', '', 1);
380 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('_MOBILE_SORT_FEEDS_UNREAD', 1, 'false', '', 1);
382 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('_THEME_ID', 2, '0', '', 1);
384 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('USER_TIMEZONE', 2, 'UTC', 'User timezone', 1);
386 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
,help_text
) values('USER_STYLESHEET', 2, '', 'Customize stylesheet', 2, 'Customize CSS stylesheet to your liking');
388 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
,help_text
) values('SORT_HEADLINES_BY_FEED_DATE', 1, 'true', 'Sort headlines by feed date',2, 'Use feed-specified date to sort headlines instead of local import date.');
390 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('_MOBILE_BROWSE_CATS', 1, 'true', '', 1);
392 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
,help_text
) values('SSL_CERT_SERIAL', 2, '', 'Login with an SSL certificate',3, 'Click to register your SSL client certificate with tt-rss');
394 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
,help_text
) values('DIGEST_PREFERRED_TIME', 2, '00:00', 'Try to send digests around specified time', 4, 'Uses UTC timezone');
396 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('_PREFS_SHOW_EMPTY_CATS', 1, 'false', '', 1);
398 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('_DEFAULT_INCLUDE_CHILDREN', 1, 'false', '', 1);
400 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('AUTO_ASSIGN_LABELS', 1, 'true', 'Assign articles to labels automatically', 3);
402 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('_ENABLED_PLUGINS', 2, '', '', 1);
404 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('_MOBILE_REVERSE_HEADLINES', 1, 'false', '', 1);
406 update ttrss_prefs
set access_level
= 1 where pref_name
in ('ON_CATCHUP_SHOW_NEXT_FEED',
407 'SORT_HEADLINES_BY_FEED_DATE',
408 'VFEED_GROUP_BY_FEED',
409 'FRESH_ARTICLE_MAX_AGE',
411 'SHOW_CONTENT_PREVIEW',
412 'AUTO_ASSIGN_LABELS',
413 'HIDE_READ_SHOWS_SPECIAL');
415 create table ttrss_user_prefs (
416 owner_uid
integer not null references ttrss_users(id) ON DELETE CASCADE,
417 pref_name
varchar(250) not null references ttrss_prefs(pref_name
) ON DELETE CASCADE,
418 profile
integer references ttrss_settings_profiles(id) ON DELETE CASCADE,
419 value text not null);
421 create index ttrss_user_prefs_owner_uid_index
on ttrss_user_prefs(owner_uid
);
422 create index ttrss_user_prefs_pref_name_idx
on ttrss_user_prefs(pref_name
);
423 -- create index ttrss_user_prefs_value_index on ttrss_user_prefs(value);
425 create table ttrss_sessions (id varchar(250) unique not null primary key,
427 expire
integer not null);
429 create index ttrss_sessions_expire_index
on ttrss_sessions(expire
);
431 create function SUBSTRING_FOR_DATE(timestamp, int, int) RETURNS text AS 'SELECT SUBSTRING(CAST($1 AS text), $2, $3)' LANGUAGE 'sql';
433 create table ttrss_feedbrowser_cache (
434 feed_url
text not null primary key,
436 site_url
text not null,
437 subscribers
integer not null);
439 create table ttrss_labels2 (id serial
not null primary key,
440 owner_uid
integer not null references ttrss_users(id) ON DELETE CASCADE,
441 fg_color
varchar(15) not null default '',
442 bg_color
varchar(15) not null default '',
443 caption
varchar(250) not null
446 create table ttrss_user_labels2 (
447 label_id
integer not null references ttrss_labels2(id) ON DELETE CASCADE,
448 article_id
integer not null references ttrss_entries(id) ON DELETE CASCADE
451 create table ttrss_access_keys (id serial
not null primary key,
452 access_key
varchar(250) not null,
453 feed_id
varchar(250) not null,
454 is_cat
boolean not null default false,
455 owner_uid
integer not null references ttrss_users(id) on delete cascade);
457 create table ttrss_linked_instances (id serial
not null primary key,
458 last_connected
timestamp not null,
459 last_status_in
integer not null,
460 last_status_out
integer not null,
461 access_key
varchar(250) not null unique,
462 access_url
text not null);
464 create table ttrss_linked_feeds (
465 feed_url
text not null,
466 site_url
text not null,
468 created
timestamp not null,
469 updated
timestamp not null,
470 instance_id
integer not null references ttrss_linked_instances(id) ON DELETE CASCADE,
471 subscribers
integer not null);
473 create table ttrss_plugin_storage (
474 id serial
not null primary key,
475 name varchar(100) not null,
476 owner_uid
integer not null references ttrss_users(id) ON DELETE CASCADE,
477 content text not null);