3 drop table ttrss_user_entries
;
4 drop table ttrss_entries
;
6 drop table ttrss_feeds
;
7 drop table ttrss_labels
;
8 drop table ttrss_filters
;
10 drop table ttrss_user_prefs
;
11 drop table ttrss_users
;
13 create table ttrss_users (id serial
not null primary key,
14 login varchar(120) not null unique,
15 pwd_hash
varchar(250) not null,
16 last_login
timestamp default null,
17 access_level
integer not null default 0);
19 insert into ttrss_users (login,pwd_hash
,access_level
) values ('admin', 'password', 10);
21 create table ttrss_feeds (id serial
not null primary key,
22 owner_uid
integer not null references ttrss_users(id) on delete cascade,
23 title
varchar(200) not null,
24 feed_url
varchar(250) not null,
25 icon_url
varchar(250) not null default '',
26 update_interval
integer not null default 0,
27 purge_interval
integer not null default 0,
28 last_updated
timestamp default null,
29 last_error
text not null default '',
30 site_url
varchar(250) not null default '');
32 create index ttrss_feeds_owner_uid_index
on ttrss_feeds(owner_uid
);
34 insert into ttrss_feeds (owner_uid
,title
,feed_url
) values (1,'Footnotes', 'http://gnomedesktop.org/node/feed');
35 insert into ttrss_feeds (owner_uid
,title
,feed_url
) values (1,'Latest Linux Kernel Versions','http://kernel.org/kdist/rss.xml');
36 insert into ttrss_feeds (owner_uid
,title
,feed_url
) values (1,'RPGDot Newsfeed',
37 'http://www.rpgdot.com/team/rss/rss0.xml');
38 insert into ttrss_feeds (owner_uid
,title
,feed_url
) values (1,'Digg.com News',
39 'http://digg.com/rss/index.xml');
40 insert into ttrss_feeds (owner_uid
,title
,feed_url
) values (1,'Technocrat.net',
41 'http://syndication.technocrat.net/rss');
43 create table ttrss_entries (id serial
not null primary key,
45 guid
text not null unique,
47 updated
timestamp not null,
48 content text not null,
49 content_hash
varchar(250) not null,
50 no_orig_date
boolean not null default false,
51 date_entered
timestamp not null default NOW(),
52 comments varchar(250) not null default '');
54 create index ttrss_entries_guid_index
on ttrss_entries(guid
);
55 create index ttrss_entries_title_index
on ttrss_entries(title
);
57 create table ttrss_user_entries (
58 int_id serial
not null primary key,
59 ref_id
integer not null references ttrss_entries(id) ON DELETE CASCADE,
60 feed_id
int references ttrss_feeds(id) ON DELETE CASCADE not null,
61 owner_uid
integer not null references ttrss_users(id) ON DELETE CASCADE,
62 marked
boolean not null default false,
64 unread
boolean not null default true);
66 create index ttrss_user_entries_feed_id_index
on ttrss_user_entries(feed_id
);
67 create index ttrss_user_entries_owner_uid_index
on ttrss_user_entries(owner_uid
);
68 create index ttrss_user_entries_ref_id_index
on ttrss_user_entries(ref_id
);
70 drop table ttrss_filters
;
71 drop table ttrss_filter_types
;
73 create table ttrss_filter_types (id integer not null primary key,
74 name varchar(120) unique not null,
75 description
varchar(250) not null unique);
77 insert into ttrss_filter_types (id,name,description
) values (1, 'title', 'Title');
78 insert into ttrss_filter_types (id,name,description
) values (2, 'content', 'Content');
79 insert into ttrss_filter_types (id,name,description
) values (3, 'both',
81 insert into ttrss_filter_types (id,name,description
) values (4, 'link',
84 create table ttrss_filters (id serial
not null primary key,
85 owner_uid
integer not null references ttrss_users(id) on delete cascade,
86 filter_type
integer not null references ttrss_filter_types(id),
87 reg_exp
varchar(250) not null,
88 description
varchar(250) not null default '');
90 drop table ttrss_labels
;
92 create table ttrss_labels (id serial
not null primary key,
93 owner_uid
integer not null references ttrss_users(id) on delete cascade,
94 sql_exp
varchar(250) not null,
95 description
varchar(250) not null);
97 create index ttrss_labels_owner_uid_index
on ttrss_labels(owner_uid
);
99 insert into ttrss_labels (owner_uid
,sql_exp
,description
) values (1,'unread = true',
102 insert into ttrss_labels (owner_uid
,sql_exp
,description
) values (1,
103 'last_read is null and unread = false', 'Updated articles');
105 create table ttrss_tags (id serial
not null primary key,
106 tag_name
varchar(250) not null,
107 owner_uid
integer not null references ttrss_users(id) on delete cascade,
108 post_int_id
integer references ttrss_user_entries(int_id
) ON DELETE CASCADE not null);
110 create index ttrss_tags_owner_uid_index
on ttrss_tags(owner_uid
);
112 drop table ttrss_version
;
114 create table ttrss_version (schema_version
int not null);
116 insert into ttrss_version
values (2);
118 drop table ttrss_prefs
;
119 drop table ttrss_prefs_types
;
120 drop table ttrss_prefs_sections
;
122 create table ttrss_prefs_types (id integer not null primary key,
123 type_name
varchar(100) not null);
125 insert into ttrss_prefs_types (id, type_name
) values (1, 'bool');
126 insert into ttrss_prefs_types (id, type_name
) values (2, 'string');
127 insert into ttrss_prefs_types (id, type_name
) values (3, 'integer');
129 create table ttrss_prefs_sections (id integer not null primary key,
130 section_name
varchar(100) not null);
132 insert into ttrss_prefs_sections (id, section_name
) values (1, 'General');
133 insert into ttrss_prefs_sections (id, section_name
) values (2, 'Interface');
134 insert into ttrss_prefs_sections (id, section_name
) values (3, 'Advanced');
136 create table ttrss_prefs (pref_name
varchar(250) not null primary key,
137 type_id
integer not null references ttrss_prefs_types(id),
138 section_id
integer not null references ttrss_prefs_sections(id) default 1,
139 short_desc
text not null,
140 help_text
text not null default '',
141 def_value
text not null);
143 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('ENABLE_FEED_ICONS', 1, 'true', 'Enable icons in feedlist',2);
144 insert 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);
145 insert 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);
146 insert 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);
147 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
,help_text
) values('ENABLE_LABELS', 1, 'false', 'Enable labels',3,
148 '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.');
150 insert 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);
151 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('DISPLAY_HEADER', 1, 'true', 'Display header',2);
152 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('DISPLAY_FOOTER', 1, 'true', 'Display footer',2);
153 insert 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);
154 insert 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,
155 'Default limit for articles to display, any custom number you like (0 - disables).');
157 insert 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,
158 'Updates to all feeds will only run when the backend script is invoked with a "daemon" option on the URI stem.');
160 insert 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,
161 'Display separate dropbox for feedlist actions, if disabled these actions are available in global actions menu.');
163 insert into ttrss_prefs (pref_name
,type_id
,def_value
,short_desc
,section_id
) values('ENABLE_SPLASH', 1, 'false', 'Enable loading splashscreen',2);
165 insert 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,
166 'This option is useful when you are reading several planet-type aggregators with partially colliding userbase.
167 When disabled, it forces same posts from different feeds to appear only once.');
169 create table ttrss_user_prefs (
170 owner_uid
integer not null references ttrss_users(id) on delete cascade,
171 pref_name
varchar(250) not null references ttrss_prefs(pref_name
),
172 value text not null);
174 create index ttrss_user_prefs_owner_uid_index
on ttrss_user_prefs(owner_uid
);
175 create index ttrss_user_prefs_value_index
on ttrss_user_prefs(value);