]>
Commit | Line | Data |
---|---|---|
1 | drop table ttrss_tags; | |
2 | drop table ttrss_user_entries; | |
3 | drop table ttrss_entries; | |
4 | drop table ttrss_feeds; | |
5 | drop table ttrss_labels; | |
6 | drop table ttrss_filters; | |
7 | ||
8 | drop table ttrss_user_prefs; | |
9 | drop table ttrss_users; | |
10 | ||
11 | create 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 | ||
17 | insert into ttrss_users (login,pwd_hash,access_level) values ('admin', 'password', 10); | |
18 | ||
19 | create 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 | ||
30 | insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Footnotes', 'http://gnomedesktop.org/node/feed'); | |
31 | insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Latest Linux Kernel Versions','http://kernel.org/kdist/rss.xml'); | |
32 | insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'RPGDot Newsfeed', | |
33 | 'http://www.rpgdot.com/team/rss/rss0.xml'); | |
34 | insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Digg.com News', | |
35 | 'http://digg.com/rss/index.xml'); | |
36 | insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Technocrat.net', | |
37 | 'http://syndication.technocrat.net/rss'); | |
38 | ||
39 | create 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 | ||
51 | create 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 | ||
58 | drop table ttrss_filters; | |
59 | drop table ttrss_filter_types; | |
60 | ||
61 | create 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 | ||
65 | insert into ttrss_filter_types (id,name,description) values (1, 'title', 'Title'); | |
66 | insert into ttrss_filter_types (id,name,description) values (2, 'content', 'Content'); | |
67 | insert into ttrss_filter_types (id,name,description) values (3, 'both', | |
68 | 'Title or Content'); | |
69 | ||
70 | create 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 | ||
76 | drop table ttrss_labels; | |
77 | ||
78 | create 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 | ||
83 | insert into ttrss_labels (owner_uid,sql_exp,description) values (1,'unread = true', | |
84 | 'Unread articles'); | |
85 | ||
86 | insert into ttrss_labels (owner_uid,sql_exp,description) values (1, | |
87 | 'last_read is null and unread = false', 'Updated articles'); | |
88 | ||
89 | create 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 | ||
94 | drop table ttrss_version; | |
95 | ||
96 | create table ttrss_version (schema_version int not null); | |
97 | ||
98 | insert into ttrss_version values (2); | |
99 | ||
100 | drop table ttrss_prefs; | |
101 | drop table ttrss_prefs_types; | |
102 | drop table ttrss_prefs_sections; | |
103 | ||
104 | create table ttrss_prefs_types (id integer not null primary key, | |
105 | type_name varchar(100) not null); | |
106 | ||
107 | insert into ttrss_prefs_types (id, type_name) values (1, 'bool'); | |
108 | insert into ttrss_prefs_types (id, type_name) values (2, 'string'); | |
109 | insert into ttrss_prefs_types (id, type_name) values (3, 'integer'); | |
110 | ||
111 | create table ttrss_prefs_sections (id integer not null primary key, | |
112 | section_name varchar(100) not null); | |
113 | ||
114 | insert into ttrss_prefs_sections (id, section_name) values (1, 'General'); | |
115 | insert into ttrss_prefs_sections (id, section_name) values (2, 'Interface'); | |
116 | insert into ttrss_prefs_sections (id, section_name) values (3, 'Advanced'); | |
117 | ||
118 | create 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 | ||
125 | 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); | |
126 | 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); | |
127 | 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); | |
128 | 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); | |
129 | insert 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 | ||
132 | 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); | |
133 | insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('DISPLAY_HEADER', 1, 'true', 'Display header',2); | |
134 | insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('DISPLAY_FOOTER', 1, 'true', 'Display footer',2); | |
135 | 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); | |
136 | 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, | |
137 | 'Default limit for articles to display, any custom number you like (0 - disables).'); | |
138 | ||
139 | 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, | |
140 | 'Updates to all feeds will only run when the backend script is invoked with a "daemon" option on the URI stem.'); | |
141 | ||
142 | 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, | |
143 | 'Display separate dropbox for feedlist actions, if disabled these actions are available in global actions menu.'); | |
144 | ||
145 | insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_SPLASH', 1, 'false', 'Enable loading splashscreen',2); | |
146 | ||
147 | create 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 |