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