]> git.wh0rd.org - tt-rss.git/blame - schema/ttrss_schema_pgsql.sql
display article labels in headlines buffer
[tt-rss.git] / schema / ttrss_schema_pgsql.sql
CommitLineData
ceb30ba4
AD
1drop table ttrss_user_labels2;
2drop table ttrss_labels2;
0c630ef3 3drop table ttrss_feedbrowser_cache;
81dde650
AD
4drop table ttrss_version;
5drop table ttrss_labels;
6drop table ttrss_filters;
7drop table ttrss_filter_types;
53d6935b 8drop table ttrss_filter_actions;
81dde650
AD
9drop table ttrss_user_prefs;
10drop table ttrss_prefs;
11drop table ttrss_prefs_types;
12drop table ttrss_prefs_sections;
eb36b4eb 13drop table ttrss_tags;
963d3314 14drop table ttrss_enclosures;
8caa7999 15drop table ttrss_entry_comments;
81dde650 16drop table ttrss_user_entries;
28a80fbf 17drop table ttrss_entries;
ab5eb26f 18drop table ttrss_scheduled_updates;
4d736378 19drop table ttrss_counters_cache;
8a4c759e 20drop table ttrss_cat_counters_cache;
28a80fbf 21drop table ttrss_feeds;
4a9a8bd8 22drop table ttrss_feed_categories;
4e9dd2cd 23drop table ttrss_users;
e552e5a2 24drop table ttrss_themes;
36bfab86 25drop table ttrss_sessions;
fc2b26a6 26drop function SUBSTRING_FOR_DATE(timestamp, int, int);
e552e5a2 27
855d0ecf
AD
28begin;
29
e552e5a2
AD
30create table ttrss_themes(id serial not null primary key,
31 theme_name varchar(200) not null,
32 theme_path varchar(200) not null);
4e9dd2cd 33
e52d6bc4 34insert into ttrss_themes (theme_name, theme_path) values ('Old-skool', 'compat');
c339343b
AD
35insert into ttrss_themes (theme_name, theme_path) values ('Graycube', 'graycube');
36insert into ttrss_themes (theme_name, theme_path) values ('Default (Compact)', 'compact');
20361063 37insert into ttrss_themes (theme_name, theme_path) values ('Three-pane', '3pane');
e52d6bc4 38
2aaacbc0 39create table ttrss_users (id serial not null primary key,
4e9dd2cd
AD
40 login varchar(120) not null unique,
41 pwd_hash varchar(250) not null,
4f628ae5 42 last_login timestamp default null,
53d6935b 43 access_level integer not null default 0,
8629e09d 44 email varchar(250) not null default '',
32be4b10
AD
45 email_digest boolean not null default false,
46 last_digest_sent timestamp default null,
54a3d3cf 47 created timestamp default null,
e552e5a2 48 theme_id integer references ttrss_themes(id) default null);
4e9dd2cd 49
7f16656e
AD
50insert into ttrss_users (login,pwd_hash,access_level) values ('admin',
51 'SHA1:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', 10);
4e9dd2cd 52
4a9a8bd8 53create table ttrss_feed_categories(id serial not null primary key,
5a214f9d 54 owner_uid integer not null references ttrss_users(id) on delete cascade,
28bcadff 55 collapsed boolean not null default false,
782ddd70 56 order_id integer not null default 0,
4a9a8bd8
AD
57 title varchar(200) not null);
58
28a80fbf 59create table ttrss_feeds (id serial not null primary key,
4e9dd2cd 60 owner_uid integer not null references ttrss_users(id) on delete cascade,
6318df0e 61 title varchar(200) not null,
f0907182 62 cat_id integer default null references ttrss_feed_categories(id) on delete set null,
43398b8e 63 feed_url text not null,
b7f4bda2 64 icon_url varchar(250) not null default '',
d148926e 65 update_interval integer not null default 0,
1089b16b 66 purge_interval integer not null default 0,
ab3d0b99 67 last_updated timestamp default null,
37d379de 68 last_error text not null default '',
e93a3c96
AD
69 site_url varchar(250) not null default '',
70 auth_login varchar(250) not null default '',
de99f500 71 parent_feed integer default null references ttrss_feeds(id) on delete set null,
5b35b4de 72 private boolean not null default false,
70f6dbb1 73 auth_pass varchar(250) not null default '',
7da377ca 74 hidden boolean not null default false,
3dd9183c 75 include_in_digest boolean not null default true,
155a2a53 76 rtl_content boolean not null default false,
fb67e2ba 77 cache_images boolean not null default false,
14fb4e91 78 last_viewed timestamp default null,
3c50da83 79 last_update_started timestamp default null,
5b8534ef 80 update_method integer not null default 0,
155a2a53 81 auth_pass_encrypted boolean not null default false);
28a80fbf 82
daa25e8a
AD
83create index ttrss_feeds_owner_uid_index on ttrss_feeds(owner_uid);
84
078b5702
AD
85insert into ttrss_feeds (owner_uid, title, feed_url) values
86 (1, 'Tiny Tiny RSS: New Releases', 'http://tt-rss.spb.ru/releases.rss');
87
88insert into ttrss_feeds (owner_uid, title, feed_url) values
89 (1, 'Tiny Tiny RSS: Forum', 'http://tt-rss.spb.ru/forum/rss.php');
28a80fbf 90
4d736378 91create table ttrss_counters_cache (
8a4c759e
AD
92 feed_id integer not null,
93 owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
94 updated timestamp not null,
95 value integer not null default 0);
96
97create table ttrss_cat_counters_cache (
98 feed_id integer not null,
4d736378 99 owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
a1eba24b 100 updated timestamp not null,
4d736378
AD
101 value integer not null default 0);
102
28a80fbf 103create table ttrss_entries (id serial not null primary key,
9ad5b0de 104 title text not null,
8bbb8466 105 guid text not null unique,
49a0dd3d 106 link text not null,
8bbb8466 107 updated timestamp not null,
d76a3b03 108 content text not null,
466001c4 109 content_hash varchar(250) not null,
b82af8c3 110 no_orig_date boolean not null default false,
8bbb8466 111 date_entered timestamp not null default NOW(),
eb40e11b 112 num_comments integer not null default 0,
4bc760da
AD
113 comments varchar(250) not null default '',
114 author varchar(250) not null default '');
c62d62f6
AD
115
116create index ttrss_entries_guid_index on ttrss_entries(guid);
894ebcf5 117-- create index ttrss_entries_title_index on ttrss_entries(title);
b60e1d86 118create index ttrss_entries_date_entered_index on ttrss_entries(date_entered);
8bbb8466
AD
119
120create table ttrss_user_entries (
05732aa0 121 int_id serial not null primary key,
4c193675
AD
122 ref_id integer not null references ttrss_entries(id) ON DELETE CASCADE,
123 feed_id int references ttrss_feeds(id) ON DELETE CASCADE not null,
8bbb8466
AD
124 owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
125 marked boolean not null default false,
ffba8297 126 published boolean not null default false,
8bbb8466 127 last_read timestamp,
afb6038e 128 score int not null default 0,
b82af8c3 129 unread boolean not null default true);
a0d53889 130
894ebcf5
AD
131-- create index ttrss_user_entries_feed_id_index on ttrss_user_entries(feed_id);
132-- create index ttrss_user_entries_owner_uid_index on ttrss_user_entries(owner_uid);
daa25e8a 133create index ttrss_user_entries_ref_id_index on ttrss_user_entries(ref_id);
894ebcf5 134create index ttrss_user_entries_feed_id on ttrss_user_entries(feed_id);
daa25e8a 135
8caa7999
AD
136create table ttrss_entry_comments (id serial not null primary key,
137 ref_id integer not null references ttrss_entries(id) ON DELETE CASCADE,
138 owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
139 private boolean not null default false,
140 date_entered timestamp not null);
141
142create index ttrss_entry_comments_ref_id_index on ttrss_entry_comments(ref_id);
894ebcf5 143-- create index ttrss_entry_comments_owner_uid_index on ttrss_entry_comments(owner_uid);
8caa7999 144
2aaacbc0 145create table ttrss_filter_types (id integer not null primary key,
a0d53889
AD
146 name varchar(120) unique not null,
147 description varchar(250) not null unique);
148
149insert into ttrss_filter_types (id,name,description) values (1, 'title', 'Title');
150insert into ttrss_filter_types (id,name,description) values (2, 'content', 'Content');
151insert into ttrss_filter_types (id,name,description) values (3, 'both',
bdc00fe0 152 'Title or Content');
3a933f22
AD
153insert into ttrss_filter_types (id,name,description) values (4, 'link',
154 'Link');
75fa1e31
AD
155insert into ttrss_filter_types (id,name,description) values (5, 'date',
156 'Article Date');
a0d53889 157
53d6935b
AD
158create table ttrss_filter_actions (id integer not null primary key,
159 name varchar(120) unique not null,
160 description varchar(250) not null unique);
161
162insert into ttrss_filter_actions (id,name,description) values (1, 'filter',
163 'Filter article');
164
165insert into ttrss_filter_actions (id,name,description) values (2, 'catchup',
166 'Mark as read');
167
dd7d3187
AD
168insert into ttrss_filter_actions (id,name,description) values (3, 'mark',
169 'Set starred');
170
7cb9311b 171insert into ttrss_filter_actions (id,name,description) values (4, 'tag',
de07b5ee 172 'Assign tags');
7cb9311b 173
0c4811be
AD
174insert into ttrss_filter_actions (id,name,description) values (5, 'publish',
175 'Publish article');
176
fdb7b03f
AD
177insert into ttrss_filter_actions (id,name,description) values (6, 'score',
178 'Modify score');
179
ceb30ba4
AD
180insert into ttrss_filter_actions (id,name,description) values (7, 'label',
181 'Assign label');
182
2bbd16b9 183create table ttrss_filters (id serial not null primary key,
4e9dd2cd 184 owner_uid integer not null references ttrss_users(id) on delete cascade,
e55a298d 185 feed_id integer references ttrss_feeds(id) on delete cascade default null,
a0d53889 186 filter_type integer not null references ttrss_filter_types(id),
4b3dff6e 187 reg_exp varchar(250) not null,
2362de6d 188 filter_param varchar(250) not null default '',
4fd52ba4 189 enabled boolean not null default true,
3f2ff803 190 inverse boolean not null default false,
9ebaec05 191 action_id integer not null default 1 references ttrss_filter_actions(id) on delete cascade,
91d64fb8 192 action_param varchar(250) not null default '');
a0d53889 193
2aaacbc0 194create table ttrss_labels (id serial not null primary key,
4e9dd2cd 195 owner_uid integer not null references ttrss_users(id) on delete cascade,
f7f939b2 196 sql_exp text not null,
48f0adb0
AD
197 description varchar(250) not null);
198
daa25e8a
AD
199create index ttrss_labels_owner_uid_index on ttrss_labels(owner_uid);
200
ee9008f9 201insert into ttrss_labels (owner_uid,sql_exp,description) values (1,'unread = true',
48f0adb0
AD
202 'Unread articles');
203
ee9008f9 204insert into ttrss_labels (owner_uid,sql_exp,description) values (1,
7cc6112a
AD
205 'last_read is null and unread = false', 'Updated articles');
206
2aaacbc0 207create table ttrss_tags (id serial not null primary key,
eb36b4eb 208 tag_name varchar(250) not null,
ee9008f9 209 owner_uid integer not null references ttrss_users(id) on delete cascade,
05732aa0 210 post_int_id integer references ttrss_user_entries(int_id) ON DELETE CASCADE not null);
eb36b4eb 211
daa25e8a
AD
212create index ttrss_tags_owner_uid_index on ttrss_tags(owner_uid);
213
5f171894
AD
214create table ttrss_version (schema_version int not null);
215
ceb30ba4 216insert into ttrss_version values (51);
5f171894 217
963d3314
AD
218create table ttrss_enclosures (id serial not null primary key,
219 content_url text not null,
220 content_type varchar(250) not null,
aa6d1e97 221 title text not null,
ce53e200 222 duration text not null,
963d3314
AD
223 post_id integer references ttrss_entries(id) ON DELETE cascade NOT NULL);
224
2aaacbc0 225create table ttrss_prefs_types (id integer not null primary key,
e0257be1
AD
226 type_name varchar(100) not null);
227
228insert into ttrss_prefs_types (id, type_name) values (1, 'bool');
229insert into ttrss_prefs_types (id, type_name) values (2, 'string');
230insert into ttrss_prefs_types (id, type_name) values (3, 'integer');
231
2aaacbc0 232create table ttrss_prefs_sections (id integer not null primary key,
e0257be1
AD
233 section_name varchar(100) not null);
234
603e9ebe
AD
235insert into ttrss_prefs_sections (id, section_name) values (1, 'General');
236insert into ttrss_prefs_sections (id, section_name) values (2, 'Interface');
650bc435 237insert into ttrss_prefs_sections (id, section_name) values (3, 'Advanced');
e0257be1 238
2aaacbc0 239create table ttrss_prefs (pref_name varchar(250) not null primary key,
e0257be1
AD
240 type_id integer not null references ttrss_prefs_types(id),
241 section_id integer not null references ttrss_prefs_sections(id) default 1,
603e9ebe
AD
242 short_desc text not null,
243 help_text text not null default '',
2b6ed06b 244 access_level integer not null default 0,
ff485f1d
AD
245 def_value text not null);
246
2dcb7e80 247insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_FEED_ICONS', 1, 'true', 'Enable feed icons',3);
ff485f1d
AD
248insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('PURGE_OLD_DAYS', 3, '60', 'Purge old posts after this number of days (0 - disables)',1);
249insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('UPDATE_POST_ON_CHECKSUM_CHANGE', 1, 'true', 'Update post on checksum change',1);
ff485f1d 250insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('ENABLE_LABELS', 1, 'false', 'Enable labels',3,
36990e33
AD
251 'Experimental support for virtual feeds based on user crafted SQL queries. This feature is highly experimental and at this point not user friendly. Use with caution.');
252
ff485f1d 253insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('DEFAULT_UPDATE_INTERVAL', 3, '30', 'Default interval between feed updates (in minutes)',1);
ff485f1d 254insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('DEFAULT_ARTICLE_LIMIT', 3, '0', 'Default article limit',2,
36990e33 255 'Default limit for articles to display, any custom number you like (0 - disables).');
36990e33 256
71604ca4 257insert 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,
8c0edbc3 258 '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.');
71604ca4 259
386d7b5b
AD
260insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('USER_STYLESHEET_URL', 2, '', 'User stylesheet URL',2,
261 'Link to user stylesheet to override default style, disabled if empty.');
262
91ff844a 263insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_FEED_CATS', 1, 'false', 'Enable feed categories',2);
10dc37ac 264
591c396d
AD
265insert 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);
266
9167e250
AD
267insert 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);
268insert 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);
269
be773442
AD
270insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('HEADLINES_SMART_DATE', 1, 'true', 'Use more accessible date/time format for headlines',3);
271
30ccc2f1
AD
272insert 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,
273 'Display expanded list of feed articles, instead of separate displays for headlines and article content');
386cbf27 274
7f123cda
AD
275insert 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);
276
68511f86
AD
277insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('OPEN_LINKS_IN_NEW_WINDOW', 1, 'true', 'Open article links in new browser window',2);
278
e52d6bc4
AD
279insert 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,
280 'When "Mark as read" button is clicked in toolbar, automatically open next feed with unread articles.');
281
c9268ed5
AD
282insert 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);
283
53c98a9a 284insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('EXTENDED_FEEDLIST', 1, 'false', 'Show additional information in feedlist',3);
78d5212c 285
4919fb42
AD
286insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('MARK_UNREAD_ON_UPDATE', 1, 'false', 'Set articles as unread on update',3);
287
d6e5706d
AD
288insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('REVERSE_HEADLINES', 1, 'false', 'Reverse headline order (oldest first)',2);
289
481c9804 290insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('DIGEST_ENABLE', 1, 'false', 'Enable e-mail digest',1,
9a61ce6d
AD
291'This option enables sending daily digest of new (and unread) headlines on your configured e-mail address');
292
f6d6e22f
AD
293insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('CONFIRM_FEED_CATCHUP', 1, 'true', 'Confirm marking feed as read',3);
294
724d7444 295insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('CDM_AUTO_CATCHUP', 1, 'false', 'Mark articles as read automatically',2,
a969b30b 296'This option enables marking articles as read automatically in combined mode (except for Fresh articles feed) while you scroll article list.');
724d7444 297
40496720
AD
298insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_MODE', 2, 'adaptive', '', 1);
299
300insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_LIMIT', 3, '30', '', 1);
301
fe8d2059 302insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_PREFS_ACTIVE_TAB', 2, '', '', 1);
87b9fb65 303
465ff90b
AD
304insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_INFOBOX_DISABLE_OVERLAY', 1, 'false', '', 1);
305
f826eee1 306insert 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,
f335e965 307'Strip all but most common HTML tags when reading articles.');
f826eee1 308
79095d68 309insert 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,
1eb19b6a
AD
310'When auto-detecting tags in articles these tags will not be applied (comma-separated list).');
311
feead173
AD
312insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_SEARCH_TOOLBAR', 1, 'false', 'Enable search toolbar',2);
313
237ec2ad
AD
314insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_PREFS_ENABLE_PAGINATION', 2, '', '', 1);
315
c59d33a3
AD
316insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_PREFS_PUBLISH_KEY', 2, '', '', 1);
317
c1d7e6c3
AD
318insert 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);
319
dc85be2b
AD
320insert 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',1);
321
bef4c245
AD
322insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('CDM_EXPANDED', 1, 'true', 'Automatically expand articles in combined mode',3);
323
07d0efe9
AD
324insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('PURGE_UNREAD_ARTICLES', 1, 'true', 'Purge unread articles',3);
325
22f3e356
AD
326insert 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',3);
327
fca93350
AD
328insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('HIDE_FEEDLIST', 1, 'false', 'Hide feedlist',2, 'This option hides feedlist and allows it to be toggled on the fly, useful for small screens.');
329
d00f22ac
AD
330insert 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,
331 'When this option is enabled, headlines in Special feeds and Labels are grouped by feeds');
332
d234a2e3
AD
333insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('SYNC_COUNTERS', 1, 'false', 'Prefer more accurate feedlist counters to UI speed',3);
334
8dccabed
AD
335insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('STRIP_IMAGES', 1, 'false', 'Do not show images in articles', 2);
336
e7490ab1 337insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('ENABLE_FLASH_PLAYER', 1, 'true', 'Enable inline MP3 player', 3, 'Enable the Flash-based XSPF Player to play MP3-format podcast enclosures.');
8dccabed 338
7b4d02a8
AD
339insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_ORDER_BY', 2, 'default', '', 1);
340
4e9dd2cd 341create table ttrss_user_prefs (
00a0bcc8
AD
342 owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
343 pref_name varchar(250) not null references ttrss_prefs(pref_name) ON DELETE CASCADE,
4e9dd2cd
AD
344 value text not null);
345
daa25e8a 346create index ttrss_user_prefs_owner_uid_index on ttrss_user_prefs(owner_uid);
894ebcf5 347-- create index ttrss_user_prefs_value_index on ttrss_user_prefs(value);
daa25e8a 348
de696427
AD
349create table ttrss_scheduled_updates (id serial not null primary key,
350 owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
351 feed_id integer default null references ttrss_feeds(id) ON DELETE CASCADE,
352 entered timestamp not null default NOW());
353
04febb04 354create table ttrss_sessions (id varchar(250) unique not null primary key,
09018e95 355 data text,
a2e9b457 356 expire integer not null);
36bfab86 357
36bfab86
AD
358create index ttrss_sessions_expire_index on ttrss_sessions(expire);
359
fc2b26a6
AD
360create function SUBSTRING_FOR_DATE(timestamp, int, int) RETURNS text AS 'SELECT SUBSTRING(CAST($1 AS text), $2, $3)' LANGUAGE 'sql';
361
0c630ef3
AD
362create table ttrss_feedbrowser_cache (
363 feed_url text not null primary key,
364 subscribers integer not null);
365
ceb30ba4
AD
366create table ttrss_labels2 (id serial not null primary key,
367 owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
368 caption varchar(250) not null
369);
370
e2549229
AD
371--INSERT INTO ttrss_labels2 (owner_uid, caption) VALUES (1, 'All Articles');
372--
373--INSERT INTO ttrss_filters (owner_uid, feed_id, filter_type, reg_exp, enabled,
374-- action_id, action_param, filter_param)
375-- VALUES (1, NULL, 1, '.', true, 7, 'All Articles', 'before');
f8bfb81f 376
ceb30ba4
AD
377create table ttrss_user_labels2 (
378 label_id integer not null references ttrss_labels2(id) ON DELETE CASCADE,
379 article_id integer not null references ttrss_entries(id) ON DELETE CASCADE
380);
381
855d0ecf 382commit;