]> git.wh0rd.org - tt-rss.git/blame - schema/ttrss_schema_pgsql.sql
actually add login.php
[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
10create table ttrss_users (id serial primary key,
11 login varchar(120) not null unique,
12 pwd_hash varchar(250) not null,
13 access_level integer not null default 0);
14
15insert into ttrss_users (login,pwd_hash,access_level) values ('admin', 'password', 10);
6318df0e
AD
16insert into ttrss_users (login,pwd_hash,access_level) values ('user-1', 'password1', 0);
17insert into ttrss_users (login,pwd_hash,access_level) values ('user-2', 'password2', 0);
4e9dd2cd 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
AD
30insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Footnotes', 'http://gnomedesktop.org/node/feed');
31insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Freedesktop.org', 'http://planet.freedesktop.org/rss20.xml');
32insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Planet Debian', 'http://planet.debian.org/rss20.xml');
33insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Planet GNOME', 'http://planet.gnome.org/rss20.xml');
34insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Planet Ubuntu', 'http://planet.ubuntulinux.org/rss20.xml');
466001c4 35
4e9dd2cd 36insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Monologue', 'http://www.go-mono.com/monologue/index.rss');
857d6a80 37
4e9dd2cd 38insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Latest Linux Kernel Versions',
857d6a80
AD
39 'http://kernel.org/kdist/rss.xml');
40
4e9dd2cd 41insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'RPGDot Newsfeed',
857d6a80
AD
42 'http://www.rpgdot.com/team/rss/rss0.xml');
43
4e9dd2cd 44insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Digg.com News',
857d6a80
AD
45 'http://digg.com/rss/index.xml');
46
4e9dd2cd 47insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Technocrat.net',
857d6a80 48 'http://syndication.technocrat.net/rss');
28a80fbf 49
28a80fbf 50create table ttrss_entries (id serial not null primary key,
b58cf266 51 owner_uid integer not null references ttrss_users(id) on delete cascade,
eb36b4eb 52 feed_id int references ttrss_feeds(id) ON DELETE CASCADE not null,
d76a3b03 53 updated timestamp not null,
9ad5b0de 54 title text not null,
4e9dd2cd 55 guid text not null,
49a0dd3d 56 link text not null,
d76a3b03 57 content text not null,
466001c4 58 content_hash varchar(250) not null,
b197f117 59 last_read timestamp,
9a4506c8 60 marked boolean not null default false,
c3a8d71a 61 date_entered timestamp not null default NOW(),
b82af8c3 62 no_orig_date boolean not null default false,
a1ea1e12 63 comments varchar(250) not null default '',
b82af8c3 64 unread boolean not null default true);
a0d53889
AD
65
66drop table ttrss_filters;
67drop table ttrss_filter_types;
68
69create table ttrss_filter_types (id integer primary key,
70 name varchar(120) unique not null,
71 description varchar(250) not null unique);
72
73insert into ttrss_filter_types (id,name,description) values (1, 'title', 'Title');
74insert into ttrss_filter_types (id,name,description) values (2, 'content', 'Content');
75insert into ttrss_filter_types (id,name,description) values (3, 'both',
bdc00fe0 76 'Title or Content');
a0d53889
AD
77
78create table ttrss_filters (id serial primary key,
4e9dd2cd 79 owner_uid integer not null references ttrss_users(id) on delete cascade,
a0d53889 80 filter_type integer not null references ttrss_filter_types(id),
4b3dff6e 81 reg_exp varchar(250) not null,
a0d53889
AD
82 description varchar(250) not null default '');
83
48f0adb0
AD
84drop table ttrss_labels;
85
86create table ttrss_labels (id serial primary key,
4e9dd2cd 87 owner_uid integer not null references ttrss_users(id) on delete cascade,
48f0adb0
AD
88 sql_exp varchar(250) not null,
89 description varchar(250) not null);
90
ee9008f9 91insert into ttrss_labels (owner_uid,sql_exp,description) values (1,'unread = true',
48f0adb0
AD
92 'Unread articles');
93
ee9008f9 94insert into ttrss_labels (owner_uid,sql_exp,description) values (1,
7cc6112a
AD
95 'last_read is null and unread = false', 'Updated articles');
96
eb36b4eb
AD
97create table ttrss_tags (id serial primary key,
98 tag_name varchar(250) not null,
ee9008f9 99 owner_uid integer not null references ttrss_users(id) on delete cascade,
eb36b4eb
AD
100 post_id integer references ttrss_entries(id) ON DELETE CASCADE not null);
101
5f171894
AD
102drop table ttrss_version;
103
104create table ttrss_version (schema_version int not null);
105
1089b16b 106insert into ttrss_version values (2);
5f171894 107
e0257be1
AD
108drop table ttrss_prefs;
109drop table ttrss_prefs_types;
110drop table ttrss_prefs_sections;
111
112create table ttrss_prefs_types (id integer primary key,
113 type_name varchar(100) not null);
114
115insert into ttrss_prefs_types (id, type_name) values (1, 'bool');
116insert into ttrss_prefs_types (id, type_name) values (2, 'string');
117insert into ttrss_prefs_types (id, type_name) values (3, 'integer');
118
119create table ttrss_prefs_sections (id integer primary key,
120 section_name varchar(100) not null);
121
603e9ebe
AD
122insert into ttrss_prefs_sections (id, section_name) values (1, 'General');
123insert into ttrss_prefs_sections (id, section_name) values (2, 'Interface');
650bc435 124insert into ttrss_prefs_sections (id, section_name) values (3, 'Advanced');
e0257be1
AD
125
126create table ttrss_prefs (pref_name varchar(250) primary key,
127 type_id integer not null references ttrss_prefs_types(id),
128 section_id integer not null references ttrss_prefs_sections(id) default 1,
603e9ebe
AD
129 short_desc text not null,
130 help_text text not null default '',
e0257be1
AD
131 def_value text not null,
132 value text not null);
133
4338e23d
AD
134insert into ttrss_prefs (pref_name,type_id,value,def_value,short_desc,section_id) values('ENABLE_FEED_ICONS', 1, 'true', 'true', 'Enable icons in feedlist',2);
135insert into ttrss_prefs (pref_name,type_id,value,def_value,short_desc,section_id) values('ICONS_DIR', 2, 'icons', 'icons', 'Local directory for feed icons',1);
136insert into ttrss_prefs (pref_name,type_id,value,def_value,short_desc,section_id) values('ICONS_URL', 2, 'icons', 'icons', 'Local URL for icons',1);
137insert into ttrss_prefs (pref_name,type_id,value,def_value,short_desc,section_id) values('PURGE_OLD_DAYS', 3, '60', '60', 'Purge old posts after this number of days (0 - disables)',1);
138insert into ttrss_prefs (pref_name,type_id,value,def_value,short_desc,section_id) values('UPDATE_POST_ON_CHECKSUM_CHANGE', 1, 'true', 'true', 'Update post on checksum change',1);
139insert into ttrss_prefs (pref_name,type_id,value,def_value,short_desc,section_id) values('ENABLE_PREFS_CATCHUP_UNCATCHUP', 1, 'false', 'false', 'Enable catchup/uncatchup buttons in feed editor',2);
650bc435 140insert into ttrss_prefs (pref_name,type_id,value,def_value,short_desc,section_id,help_text) values('ENABLE_LABELS', 1, 'false', 'false', 'Enable labels',3,
36990e33
AD
141 '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.');
142
4338e23d
AD
143insert into ttrss_prefs (pref_name,type_id,value,def_value,short_desc,section_id) values('DEFAULT_UPDATE_INTERVAL', 3, '30', '30', 'Default interval between feed updates (in minutes)',1);
144insert into ttrss_prefs (pref_name,type_id,value,def_value,short_desc,section_id) values('DISPLAY_HEADER', 1, 'true', 'true', 'Display header',2);
145insert into ttrss_prefs (pref_name,type_id,value,def_value,short_desc,section_id) values('DISPLAY_FOOTER', 1, 'true', 'true', 'Display footer',2);
146insert into ttrss_prefs (pref_name,type_id,value,def_value,short_desc,section_id) values('USE_COMPACT_STYLESHEET', 1, 'false', 'false', 'Use compact stylesheet by default',2);
36990e33
AD
147insert into ttrss_prefs (pref_name,type_id,value,def_value,short_desc,section_id,help_text) values('DEFAULT_ARTICLE_LIMIT', 3, '0', '0', 'Default article limit',2,
148 'Default limit for articles to display, any custom number you like (0 - disables).');
149
650bc435 150insert into ttrss_prefs (pref_name,type_id,value,def_value,short_desc,section_id,help_text) values('DAEMON_REFRESH_ONLY', 1, 'false', 'false', 'Daemon refresh only', 3,
36990e33
AD
151 'Updates to all feeds will only run when the backend script is invoked with a "daemon" option on the URI stem.');
152
153insert into ttrss_prefs (pref_name,type_id,value,def_value,short_desc,section_id,help_text) values('DISPLAY_FEEDLIST_ACTIONS', 1, 'false', 'false', 'Display feedlist actions',2,
154 'Display separate dropbox for feedlist actions, if disabled these actions are available in global actions menu.');
155
4338e23d 156insert into ttrss_prefs (pref_name,type_id,value,def_value,short_desc,section_id) values('ENABLE_SPLASH', 1, 'false', 'false', 'Enable loading splashscreen',2);
e0257be1 157
4e9dd2cd
AD
158create table ttrss_user_prefs (
159 owner_uid integer not null references ttrss_users(id) on delete cascade,
160 pref_name varchar(250) not null references ttrss_prefs(pref_name),
161 value text not null);
162
163