]> git.wh0rd.org - tt-rss.git/blame_incremental - 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
1drop table ttrss_tags;
2drop table ttrss_user_entries;
3drop table ttrss_entries;
4drop table ttrss_feeds;
5drop table ttrss_labels;
6drop table ttrss_filters;
7
8drop table ttrss_user_prefs;
9drop table ttrss_users;
10
11create table ttrss_users (id serial not null primary key,
12 login varchar(120) not null unique,
13 pwd_hash varchar(250) not null,
14 last_login timestamp default null,
15 access_level integer not null default 0);
16
17insert into ttrss_users (login,pwd_hash,access_level) values ('admin', 'password', 10);
18
19create table ttrss_feeds (id serial not null primary key,
20 owner_uid integer not null references ttrss_users(id) on delete cascade,
21 title varchar(200) not null,
22 feed_url varchar(250) not null,
23 icon_url varchar(250) not null default '',
24 update_interval integer not null default 0,
25 purge_interval integer not null default 0,
26 last_updated timestamp default null,
27 last_error text not null default '',
28 site_url varchar(250) not null default '');
29
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,'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');
38
39create table ttrss_entries (id serial not null primary key,
40 feed_id int references ttrss_feeds(id) ON DELETE CASCADE not null,
41 title text not null,
42 guid text not null unique,
43 link text not null,
44 updated timestamp not null,
45 content text not null,
46 content_hash varchar(250) not null,
47 no_orig_date boolean not null default false,
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,
56 unread boolean not null default true);
57
58drop table ttrss_filters;
59drop table ttrss_filter_types;
60
61create table ttrss_filter_types (id integer not null primary key,
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',
68 'Title or Content');
69
70create table ttrss_filters (id serial not null primary key,
71 owner_uid integer not null references ttrss_users(id) on delete cascade,
72 filter_type integer not null references ttrss_filter_types(id),
73 reg_exp varchar(250) not null,
74 description varchar(250) not null default '');
75
76drop table ttrss_labels;
77
78create table ttrss_labels (id serial not null primary key,
79 owner_uid integer not null references ttrss_users(id) on delete cascade,
80 sql_exp varchar(250) not null,
81 description varchar(250) not null);
82
83insert into ttrss_labels (owner_uid,sql_exp,description) values (1,'unread = true',
84 'Unread articles');
85
86insert into ttrss_labels (owner_uid,sql_exp,description) values (1,
87 'last_read is null and unread = false', 'Updated articles');
88
89create table ttrss_tags (id serial not null primary key,
90 tag_name varchar(250) not null,
91 owner_uid integer not null references ttrss_users(id) on delete cascade,
92 post_id integer references ttrss_entries(id) ON DELETE CASCADE not null);
93
94drop table ttrss_version;
95
96create table ttrss_version (schema_version int not null);
97
98insert into ttrss_version values (2);
99
100drop table ttrss_prefs;
101drop table ttrss_prefs_types;
102drop table ttrss_prefs_sections;
103
104create table ttrss_prefs_types (id integer not null primary key,
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
111create table ttrss_prefs_sections (id integer not null primary key,
112 section_name varchar(100) not null);
113
114insert into ttrss_prefs_sections (id, section_name) values (1, 'General');
115insert into ttrss_prefs_sections (id, section_name) values (2, 'Interface');
116insert into ttrss_prefs_sections (id, section_name) values (3, 'Advanced');
117
118create table ttrss_prefs (pref_name varchar(250) not null primary key,
119 type_id integer not null references ttrss_prefs_types(id),
120 section_id integer not null references ttrss_prefs_sections(id) default 1,
121 short_desc text not null,
122 help_text text not null default '',
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);
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,
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
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,
137 'Default limit for articles to display, any custom number you like (0 - disables).');
138
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,
140 'Updates to all feeds will only run when the backend script is invoked with a "daemon" option on the URI stem.');
141
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,
143 'Display separate dropbox for feedlist actions, if disabled these actions are available in global actions menu.');
144
145insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_SPLASH', 1, 'false', 'Enable loading splashscreen',2);
146
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