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