]>
Commit | Line | Data |
---|---|---|
81dde650 AD |
1 | drop table ttrss_version; |
2 | drop table ttrss_labels; | |
3 | drop table ttrss_filters; | |
4 | drop table ttrss_filter_types; | |
53d6935b | 5 | drop table ttrss_filter_actions; |
81dde650 AD |
6 | drop table ttrss_user_prefs; |
7 | drop table ttrss_prefs; | |
8 | drop table ttrss_prefs_types; | |
9 | drop table ttrss_prefs_sections; | |
eb36b4eb | 10 | drop table ttrss_tags; |
8caa7999 | 11 | drop table ttrss_entry_comments; |
81dde650 | 12 | drop table ttrss_user_entries; |
28a80fbf AD |
13 | drop table ttrss_entries; |
14 | drop table ttrss_feeds; | |
4a9a8bd8 | 15 | drop table ttrss_feed_categories; |
4e9dd2cd | 16 | drop table ttrss_users; |
e552e5a2 AD |
17 | drop table ttrss_themes; |
18 | ||
19 | create table ttrss_themes(id serial not null primary key, | |
20 | theme_name varchar(200) not null, | |
21 | theme_path varchar(200) not null); | |
4e9dd2cd | 22 | |
2aaacbc0 | 23 | create table ttrss_users (id serial not null primary key, |
4e9dd2cd AD |
24 | login varchar(120) not null unique, |
25 | pwd_hash varchar(250) not null, | |
4f628ae5 | 26 | last_login timestamp default null, |
53d6935b | 27 | access_level integer not null default 0, |
e552e5a2 | 28 | theme_id integer references ttrss_themes(id) default null); |
4e9dd2cd AD |
29 | |
30 | insert into ttrss_users (login,pwd_hash,access_level) values ('admin', 'password', 10); | |
31 | ||
4a9a8bd8 | 32 | create table ttrss_feed_categories(id serial not null primary key, |
5a214f9d | 33 | owner_uid integer not null references ttrss_users(id) on delete cascade, |
28bcadff | 34 | collapsed boolean not null default false, |
4a9a8bd8 AD |
35 | title varchar(200) not null); |
36 | ||
28a80fbf | 37 | create table ttrss_feeds (id serial not null primary key, |
4e9dd2cd | 38 | owner_uid integer not null references ttrss_users(id) on delete cascade, |
6318df0e | 39 | title varchar(200) not null, |
4a9a8bd8 | 40 | cat_id integer references ttrss_feed_categories(id) default null, |
6318df0e | 41 | feed_url varchar(250) not null, |
b7f4bda2 | 42 | icon_url varchar(250) not null default '', |
d148926e | 43 | update_interval integer not null default 0, |
1089b16b | 44 | purge_interval integer not null default 0, |
ab3d0b99 | 45 | last_updated timestamp default null, |
37d379de AD |
46 | last_error text not null default '', |
47 | site_url varchar(250) not null default ''); | |
28a80fbf | 48 | |
daa25e8a AD |
49 | create index ttrss_feeds_owner_uid_index on ttrss_feeds(owner_uid); |
50 | ||
4e9dd2cd | 51 | insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Footnotes', 'http://gnomedesktop.org/node/feed'); |
cd42edf1 AD |
52 | insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Latest Linux Kernel Versions','http://kernel.org/kdist/rss.xml'); |
53 | insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'RPGDot Newsfeed', | |
54 | 'http://www.rpgdot.com/team/rss/rss0.xml'); | |
55 | insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Digg.com News', | |
56 | 'http://digg.com/rss/index.xml'); | |
57 | insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Technocrat.net', | |
58 | 'http://syndication.technocrat.net/rss'); | |
28a80fbf | 59 | |
28a80fbf | 60 | create table ttrss_entries (id serial not null primary key, |
9ad5b0de | 61 | title text not null, |
8bbb8466 | 62 | guid text not null unique, |
49a0dd3d | 63 | link text not null, |
8bbb8466 | 64 | updated timestamp not null, |
d76a3b03 | 65 | content text not null, |
466001c4 | 66 | content_hash varchar(250) not null, |
b82af8c3 | 67 | no_orig_date boolean not null default false, |
8bbb8466 | 68 | date_entered timestamp not null default NOW(), |
eb40e11b | 69 | num_comments integer not null default 0, |
c62d62f6 AD |
70 | comments varchar(250) not null default ''); |
71 | ||
72 | create index ttrss_entries_guid_index on ttrss_entries(guid); | |
73 | create index ttrss_entries_title_index on ttrss_entries(title); | |
8bbb8466 AD |
74 | |
75 | create table ttrss_user_entries ( | |
05732aa0 | 76 | int_id serial not null primary key, |
4c193675 AD |
77 | ref_id integer not null references ttrss_entries(id) ON DELETE CASCADE, |
78 | feed_id int references ttrss_feeds(id) ON DELETE CASCADE not null, | |
8bbb8466 AD |
79 | owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE, |
80 | marked boolean not null default false, | |
81 | last_read timestamp, | |
b82af8c3 | 82 | unread boolean not null default true); |
a0d53889 | 83 | |
daa25e8a AD |
84 | create index ttrss_user_entries_feed_id_index on ttrss_user_entries(feed_id); |
85 | create index ttrss_user_entries_owner_uid_index on ttrss_user_entries(owner_uid); | |
86 | create index ttrss_user_entries_ref_id_index on ttrss_user_entries(ref_id); | |
87 | ||
8caa7999 AD |
88 | create table ttrss_entry_comments (id serial not null primary key, |
89 | ref_id integer not null references ttrss_entries(id) ON DELETE CASCADE, | |
90 | owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE, | |
91 | private boolean not null default false, | |
92 | date_entered timestamp not null); | |
93 | ||
94 | create index ttrss_entry_comments_ref_id_index on ttrss_entry_comments(ref_id); | |
95 | create index ttrss_entry_comments_owner_uid_index on ttrss_entry_comments(owner_uid); | |
96 | ||
2aaacbc0 | 97 | create table ttrss_filter_types (id integer not null primary key, |
a0d53889 AD |
98 | name varchar(120) unique not null, |
99 | description varchar(250) not null unique); | |
100 | ||
101 | insert into ttrss_filter_types (id,name,description) values (1, 'title', 'Title'); | |
102 | insert into ttrss_filter_types (id,name,description) values (2, 'content', 'Content'); | |
103 | insert into ttrss_filter_types (id,name,description) values (3, 'both', | |
bdc00fe0 | 104 | 'Title or Content'); |
3a933f22 AD |
105 | insert into ttrss_filter_types (id,name,description) values (4, 'link', |
106 | 'Link'); | |
a0d53889 | 107 | |
53d6935b AD |
108 | create table ttrss_filter_actions (id integer not null primary key, |
109 | name varchar(120) unique not null, | |
110 | description varchar(250) not null unique); | |
111 | ||
112 | insert into ttrss_filter_actions (id,name,description) values (1, 'filter', | |
113 | 'Filter article'); | |
114 | ||
115 | insert into ttrss_filter_actions (id,name,description) values (2, 'catchup', | |
116 | 'Mark as read'); | |
117 | ||
2bbd16b9 | 118 | create table ttrss_filters (id serial not null primary key, |
4e9dd2cd | 119 | owner_uid integer not null references ttrss_users(id) on delete cascade, |
e55a298d | 120 | feed_id integer references ttrss_feeds(id) on delete cascade default null, |
a0d53889 | 121 | filter_type integer not null references ttrss_filter_types(id), |
4b3dff6e | 122 | reg_exp varchar(250) not null, |
53d6935b AD |
123 | description varchar(250) not null default '', |
124 | action_id integer not null default 1 references ttrss_filter_actions(id) on delete cascade); | |
a0d53889 | 125 | |
2aaacbc0 | 126 | create table ttrss_labels (id serial not null primary key, |
4e9dd2cd | 127 | owner_uid integer not null references ttrss_users(id) on delete cascade, |
48f0adb0 AD |
128 | sql_exp varchar(250) not null, |
129 | description varchar(250) not null); | |
130 | ||
daa25e8a AD |
131 | create index ttrss_labels_owner_uid_index on ttrss_labels(owner_uid); |
132 | ||
ee9008f9 | 133 | insert into ttrss_labels (owner_uid,sql_exp,description) values (1,'unread = true', |
48f0adb0 AD |
134 | 'Unread articles'); |
135 | ||
ee9008f9 | 136 | insert into ttrss_labels (owner_uid,sql_exp,description) values (1, |
7cc6112a AD |
137 | 'last_read is null and unread = false', 'Updated articles'); |
138 | ||
2aaacbc0 | 139 | create table ttrss_tags (id serial not null primary key, |
eb36b4eb | 140 | tag_name varchar(250) not null, |
ee9008f9 | 141 | owner_uid integer not null references ttrss_users(id) on delete cascade, |
05732aa0 | 142 | post_int_id integer references ttrss_user_entries(int_id) ON DELETE CASCADE not null); |
eb36b4eb | 143 | |
daa25e8a AD |
144 | create index ttrss_tags_owner_uid_index on ttrss_tags(owner_uid); |
145 | ||
5f171894 AD |
146 | create table ttrss_version (schema_version int not null); |
147 | ||
1089b16b | 148 | insert into ttrss_version values (2); |
5f171894 | 149 | |
2aaacbc0 | 150 | create table ttrss_prefs_types (id integer not null primary key, |
e0257be1 AD |
151 | type_name varchar(100) not null); |
152 | ||
153 | insert into ttrss_prefs_types (id, type_name) values (1, 'bool'); | |
154 | insert into ttrss_prefs_types (id, type_name) values (2, 'string'); | |
155 | insert into ttrss_prefs_types (id, type_name) values (3, 'integer'); | |
156 | ||
2aaacbc0 | 157 | create table ttrss_prefs_sections (id integer not null primary key, |
e0257be1 AD |
158 | section_name varchar(100) not null); |
159 | ||
603e9ebe AD |
160 | insert into ttrss_prefs_sections (id, section_name) values (1, 'General'); |
161 | insert into ttrss_prefs_sections (id, section_name) values (2, 'Interface'); | |
650bc435 | 162 | insert into ttrss_prefs_sections (id, section_name) values (3, 'Advanced'); |
e0257be1 | 163 | |
2aaacbc0 | 164 | create table ttrss_prefs (pref_name varchar(250) not null primary key, |
e0257be1 AD |
165 | type_id integer not null references ttrss_prefs_types(id), |
166 | section_id integer not null references ttrss_prefs_sections(id) default 1, | |
603e9ebe AD |
167 | short_desc text not null, |
168 | help_text text not null default '', | |
ff485f1d AD |
169 | def_value text not null); |
170 | ||
171 | insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_FEED_ICONS', 1, 'true', 'Enable icons in feedlist',2); | |
ff485f1d AD |
172 | insert 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); |
173 | insert 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); | |
174 | insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_PREFS_CATCHUP_UNCATCHUP', 1, 'false', 'Enable catchup/uncatchup buttons in feed editor',2); | |
175 | insert 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 |
176 | '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.'); |
177 | ||
ff485f1d AD |
178 | 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 (in minutes)',1); |
179 | insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('DISPLAY_HEADER', 1, 'true', 'Display header',2); | |
180 | insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('DISPLAY_FOOTER', 1, 'true', 'Display footer',2); | |
181 | insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('USE_COMPACT_STYLESHEET', 1, 'false', 'Use compact stylesheet by default',2); | |
182 | insert 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 AD |
183 | 'Default limit for articles to display, any custom number you like (0 - disables).'); |
184 | ||
ff485f1d | 185 | insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('DISPLAY_FEEDLIST_ACTIONS', 1, 'false', 'Display feedlist actions',2, |
36990e33 AD |
186 | 'Display separate dropbox for feedlist actions, if disabled these actions are available in global actions menu.'); |
187 | ||
71604ca4 AD |
188 | 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, |
189 | 'This option is useful when you are reading several planet-type aggregators with partially colliding userbase. | |
14c8eca7 | 190 | When disabled, it forces same posts from different feeds to appear only once.'); |
71604ca4 | 191 | |
386d7b5b AD |
192 | insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('USER_STYLESHEET_URL', 2, '', 'User stylesheet URL',2, |
193 | 'Link to user stylesheet to override default style, disabled if empty.'); | |
194 | ||
91ff844a | 195 | insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_FEED_CATS', 1, 'false', 'Enable feed categories',2); |
10dc37ac | 196 | |
591c396d AD |
197 | 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); |
198 | ||
9167e250 AD |
199 | 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); |
200 | 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); | |
201 | ||
be773442 AD |
202 | insert 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); |
203 | ||
30ccc2f1 AD |
204 | 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, |
205 | 'Display expanded list of feed articles, instead of separate displays for headlines and article content'); | |
386cbf27 | 206 | |
4e9dd2cd | 207 | create table ttrss_user_prefs ( |
00a0bcc8 AD |
208 | owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE, |
209 | pref_name varchar(250) not null references ttrss_prefs(pref_name) ON DELETE CASCADE, | |
4e9dd2cd AD |
210 | value text not null); |
211 | ||
daa25e8a AD |
212 | create index ttrss_user_prefs_owner_uid_index on ttrss_user_prefs(owner_uid); |
213 | create index ttrss_user_prefs_value_index on ttrss_user_prefs(value); | |
214 | ||
4e9dd2cd | 215 |