]> git.wh0rd.org - tt-rss.git/blame - schema/ttrss_schema_pgsql.sql
respect $fetch in update_all_feeds (forceUpdateAllFeeds handling)
[tt-rss.git] / schema / ttrss_schema_pgsql.sql
CommitLineData
eb36b4eb 1drop table ttrss_tags;
28a80fbf
AD
2drop table ttrss_entries;
3drop table ttrss_feeds;
ee9008f9
AD
4drop table ttrss_labels;
5drop table ttrss_filters;
28a80fbf 6
4e9dd2cd
AD
7drop table ttrss_user_prefs;
8drop table ttrss_users;
9
2aaacbc0 10create table ttrss_users (id serial not null primary key,
4e9dd2cd
AD
11 login varchar(120) not null unique,
12 pwd_hash varchar(250) not null,
4f628ae5 13 last_login timestamp default null,
4e9dd2cd
AD
14 access_level integer not null default 0);
15
16insert into ttrss_users (login,pwd_hash,access_level) values ('admin', 'password', 10);
17
28a80fbf 18create table ttrss_feeds (id serial not null primary key,
4e9dd2cd 19 owner_uid integer not null references ttrss_users(id) on delete cascade,
6318df0e
AD
20 title varchar(200) not null,
21 feed_url varchar(250) not null,
b7f4bda2 22 icon_url varchar(250) not null default '',
d148926e 23 update_interval integer not null default 0,
1089b16b 24 purge_interval integer not null default 0,
ab3d0b99 25 last_updated timestamp default null,
37d379de
AD
26 last_error text not null default '',
27 site_url varchar(250) not null default '');
28a80fbf 28
4e9dd2cd 29insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Footnotes', 'http://gnomedesktop.org/node/feed');
cd42edf1
AD
30insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Latest Linux Kernel Versions','http://kernel.org/kdist/rss.xml');
31insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'RPGDot Newsfeed',
32 'http://www.rpgdot.com/team/rss/rss0.xml');
33insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Digg.com News',
34 'http://digg.com/rss/index.xml');
35insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Technocrat.net',
36 'http://syndication.technocrat.net/rss');
28a80fbf 37
28a80fbf 38create table ttrss_entries (id serial not null primary key,
b58cf266 39 owner_uid integer not null references ttrss_users(id) on delete cascade,
eb36b4eb 40 feed_id int references ttrss_feeds(id) ON DELETE CASCADE not null,
d76a3b03 41 updated timestamp not null,
9ad5b0de 42 title text not null,
4e9dd2cd 43 guid text not null,
49a0dd3d 44 link text not null,
d76a3b03 45 content text not null,
466001c4 46 content_hash varchar(250) not null,
b197f117 47 last_read timestamp,
9a4506c8 48 marked boolean not null default false,
c3a8d71a 49 date_entered timestamp not null default NOW(),
b82af8c3 50 no_orig_date boolean not null default false,
a1ea1e12 51 comments varchar(250) not null default '',
b82af8c3 52 unread boolean not null default true);
a0d53889
AD
53
54drop table ttrss_filters;
55drop table ttrss_filter_types;
56
2aaacbc0 57create table ttrss_filter_types (id integer not null primary key,
a0d53889
AD
58 name varchar(120) unique not null,
59 description varchar(250) not null unique);
60
61insert into ttrss_filter_types (id,name,description) values (1, 'title', 'Title');
62insert into ttrss_filter_types (id,name,description) values (2, 'content', 'Content');
63insert into ttrss_filter_types (id,name,description) values (3, 'both',
bdc00fe0 64 'Title or Content');
a0d53889 65
2aaacbc0 66create table ttrss_filters (id serial not null primary key,
4e9dd2cd 67 owner_uid integer not null references ttrss_users(id) on delete cascade,
a0d53889 68 filter_type integer not null references ttrss_filter_types(id),
4b3dff6e 69 reg_exp varchar(250) not null,
a0d53889
AD
70 description varchar(250) not null default '');
71
48f0adb0
AD
72drop table ttrss_labels;
73
2aaacbc0 74create table ttrss_labels (id serial not null primary key,
4e9dd2cd 75 owner_uid integer not null references ttrss_users(id) on delete cascade,
48f0adb0
AD
76 sql_exp varchar(250) not null,
77 description varchar(250) not null);
78
ee9008f9 79insert into ttrss_labels (owner_uid,sql_exp,description) values (1,'unread = true',
48f0adb0
AD
80 'Unread articles');
81
ee9008f9 82insert into ttrss_labels (owner_uid,sql_exp,description) values (1,
7cc6112a
AD
83 'last_read is null and unread = false', 'Updated articles');
84
2aaacbc0 85create table ttrss_tags (id serial not null primary key,
eb36b4eb 86 tag_name varchar(250) not null,
ee9008f9 87 owner_uid integer not null references ttrss_users(id) on delete cascade,
eb36b4eb
AD
88 post_id integer references ttrss_entries(id) ON DELETE CASCADE not null);
89
5f171894
AD
90drop table ttrss_version;
91
92create table ttrss_version (schema_version int not null);
93
1089b16b 94insert into ttrss_version values (2);
5f171894 95
e0257be1
AD
96drop table ttrss_prefs;
97drop table ttrss_prefs_types;
98drop table ttrss_prefs_sections;
99
2aaacbc0 100create table ttrss_prefs_types (id integer not null primary key,
e0257be1
AD
101 type_name varchar(100) not null);
102
103insert into ttrss_prefs_types (id, type_name) values (1, 'bool');
104insert into ttrss_prefs_types (id, type_name) values (2, 'string');
105insert into ttrss_prefs_types (id, type_name) values (3, 'integer');
106
2aaacbc0 107create table ttrss_prefs_sections (id integer not null primary key,
e0257be1
AD
108 section_name varchar(100) not null);
109
603e9ebe
AD
110insert into ttrss_prefs_sections (id, section_name) values (1, 'General');
111insert into ttrss_prefs_sections (id, section_name) values (2, 'Interface');
650bc435 112insert into ttrss_prefs_sections (id, section_name) values (3, 'Advanced');
e0257be1 113
2aaacbc0 114create table ttrss_prefs (pref_name varchar(250) not null primary key,
e0257be1
AD
115 type_id integer not null references ttrss_prefs_types(id),
116 section_id integer not null references ttrss_prefs_sections(id) default 1,
603e9ebe
AD
117 short_desc text not null,
118 help_text text not null default '',
ff485f1d
AD
119 def_value text not null);
120
121insert 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
122insert 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);
123insert 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);
124insert 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);
125insert 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
126 '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.');
127
ff485f1d
AD
128insert 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);
129insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('DISPLAY_HEADER', 1, 'true', 'Display header',2);
130insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('DISPLAY_FOOTER', 1, 'true', 'Display footer',2);
131insert 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);
132insert 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
133 'Default limit for articles to display, any custom number you like (0 - disables).');
134
ff485f1d 135insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('DAEMON_REFRESH_ONLY', 1, 'false', 'Daemon refresh only', 3,
36990e33
AD
136 'Updates to all feeds will only run when the backend script is invoked with a "daemon" option on the URI stem.');
137
ff485f1d 138insert 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
139 'Display separate dropbox for feedlist actions, if disabled these actions are available in global actions menu.');
140
ff485f1d 141insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_SPLASH', 1, 'false', 'Enable loading splashscreen',2);
e0257be1 142
4e9dd2cd
AD
143create table ttrss_user_prefs (
144 owner_uid integer not null references ttrss_users(id) on delete cascade,
145 pref_name varchar(250) not null references ttrss_prefs(pref_name),
146 value text not null);
147
148