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