]> git.wh0rd.org - tt-rss.git/blame - schema/ttrss_schema_mysql.sql
filters are now actually applied separately for each user
[tt-rss.git] / schema / ttrss_schema_mysql.sql
CommitLineData
eb36b4eb 1drop table if exists ttrss_tags;
c62d62f6
AD
2
3drop table if exists ttrss_user_entries;
648472a7 4drop table if exists ttrss_entries;
c62d62f6 5
648472a7 6drop table if exists ttrss_feeds;
a6ccf566
AD
7drop table if exists ttrss_labels;
8drop table if exists ttrss_filters;
9
10drop table if exists ttrss_user_prefs;
11drop table if exists ttrss_users;
12
13create table ttrss_users (id integer primary key not null auto_increment,
14 login varchar(120) not null unique,
15 pwd_hash varchar(250) not null,
f16ef236 16 last_login datetime default null,
a6ccf566
AD
17 access_level integer not null default 0) TYPE=InnoDB;
18
19insert into ttrss_users (login,pwd_hash,access_level) values ('admin', 'password', 10);
648472a7
AD
20
21create table ttrss_feeds (id integer not null auto_increment primary key,
a6ccf566
AD
22 owner_uid integer not null,
23 title varchar(200) not null,
24 feed_url varchar(250) not null,
648472a7 25 icon_url varchar(250) not null default '',
d148926e 26 update_interval integer not null default 0,
1089b16b 27 purge_interval integer not null default 0,
ab3d0b99 28 last_updated datetime default '',
37d379de 29 last_error text not null default '',
a6ccf566
AD
30 site_url varchar(250) not null default '',
31 index(owner_uid),
32 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) TYPE=InnoDB;
33
34insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Footnotes', 'http://gnomedesktop.org/node/feed');
cd42edf1 35insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Latest Linux Kernel Versions','http://kernel.org/kdist/rss.xml');
a6ccf566
AD
36insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'RPGDot Newsfeed',
37 'http://www.rpgdot.com/team/rss/rss0.xml');
a6ccf566
AD
38insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Digg.com News',
39 'http://digg.com/rss/index.xml');
a6ccf566
AD
40insert into ttrss_feeds (owner_uid,title,feed_url) values (1,'Technocrat.net',
41 'http://syndication.technocrat.net/rss');
648472a7 42
648472a7 43create table ttrss_entries (id integer not null primary key auto_increment,
9ad5b0de 44 title text not null,
c62d62f6 45 guid varchar(255) not null unique,
49a0dd3d 46 link text not null,
c62d62f6 47 updated datetime not null,
648472a7
AD
48 content text not null,
49 content_hash varchar(250) not null,
8158c57a 50 no_orig_date bool not null default 0,
c62d62f6
AD
51 date_entered datetime not null,
52 comments varchar(250) not null default '') TYPE=InnoDB;
53
54create table ttrss_user_entries (
55 int_id integer not null primary key auto_increment,
56 ref_id integer not null,
57 feed_id int not null,
58 owner_uid integer not null,
59 marked bool not null default 0,
60 last_read datetime,
1696229f 61 unread bool not null default 1,
c62d62f6
AD
62 index (ref_id),
63 foreign key (ref_id) references ttrss_entries(id) ON DELETE CASCADE,
1696229f 64 index (feed_id),
a6ccf566
AD
65 foreign key (feed_id) references ttrss_feeds(id) ON DELETE CASCADE,
66 index (owner_uid),
67 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) TYPE=InnoDB;
648472a7
AD
68
69drop table if exists ttrss_filters;
70drop table if exists ttrss_filter_types;
71
72create table ttrss_filter_types (id integer primary key,
73 name varchar(120) unique not null,
4b3dff6e 74 description varchar(250) not null unique) TYPE=InnoDB;
648472a7 75
648472a7
AD
76insert into ttrss_filter_types (id,name,description) values (1, 'title', 'Title');
77insert into ttrss_filter_types (id,name,description) values (2, 'content', 'Content');
78insert into ttrss_filter_types (id,name,description) values (3, 'both',
79 'Title or Content');
3a933f22
AD
80insert into ttrss_filter_types (id,name,description) values (4, 'link',
81 'Link');
648472a7 82
a6ccf566
AD
83create table ttrss_filters (id integer not null primary key auto_increment,
84 owner_uid integer not null,
85 filter_type integer not null,
4b3dff6e 86 reg_exp varchar(250) not null,
a6ccf566
AD
87 description varchar(250) not null default '',
88 index (filter_type),
89 foreign key (filter_type) references ttrss_filter_types(id) ON DELETE CASCADE,
90 index (owner_uid),
91 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) TYPE=InnoDB;
648472a7 92
a82065a1 93drop table if exists ttrss_labels;
48f0adb0 94
a6ccf566
AD
95create table ttrss_labels (id integer not null primary key auto_increment,
96 owner_uid integer not null,
48f0adb0 97 sql_exp varchar(250) not null,
a6ccf566
AD
98 description varchar(250) not null,
99 index (owner_uid),
100 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) TYPE=InnoDB;
48f0adb0 101
a6ccf566 102insert into ttrss_labels (owner_uid,sql_exp,description) values (1,'unread = true',
48f0adb0 103 'Unread articles');
648472a7 104
a6ccf566 105insert into ttrss_labels (owner_uid,sql_exp,description) values (1,
7cc6112a
AD
106 'last_read is null and unread = false', 'Updated articles');
107
eb36b4eb 108create table ttrss_tags (id integer primary key auto_increment,
a6ccf566 109 owner_uid integer not null,
eb36b4eb 110 tag_name varchar(250) not null,
c62d62f6
AD
111 post_int_id integer not null,
112 index (post_int_id),
113 foreign key (post_int_id) references ttrss_user_entries(int_id) ON DELETE CASCADE,
a6ccf566
AD
114 index (owner_uid),
115 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE) TYPE=InnoDB;
eb36b4eb 116
a6ccf566 117drop table if exists ttrss_version;
5f171894
AD
118
119create table ttrss_version (schema_version int not null) TYPE=InnoDB;
120
1089b16b 121insert into ttrss_version values (2);
5f171894 122
a6ccf566
AD
123drop table if exists ttrss_prefs;
124drop table if exists ttrss_prefs_types;
125drop table if exists ttrss_prefs_sections;
2fb72ab9 126
a6ccf566 127create table ttrss_prefs_types (id integer not null primary key,
e0257be1
AD
128 type_name varchar(100) not null) TYPE=InnoDB;
129
130insert into ttrss_prefs_types (id, type_name) values (1, 'bool');
131insert into ttrss_prefs_types (id, type_name) values (2, 'string');
132insert into ttrss_prefs_types (id, type_name) values (3, 'integer');
133
a6ccf566 134create table ttrss_prefs_sections (id integer not null primary key,
e0257be1
AD
135 section_name varchar(100) not null) TYPE=InnoDB;
136
603e9ebe
AD
137insert into ttrss_prefs_sections (id, section_name) values (1, 'General');
138insert into ttrss_prefs_sections (id, section_name) values (2, 'Interface');
650bc435 139insert into ttrss_prefs_sections (id, section_name) values (3, 'Advanced');
e0257be1 140
a6ccf566 141create table ttrss_prefs (pref_name varchar(250) not null primary key,
e0257be1
AD
142 type_id integer not null,
143 section_id integer not null default 1,
603e9ebe
AD
144 short_desc text not null,
145 help_text text not null default '',
e0257be1 146 def_value text not null,
e0257be1
AD
147 index(type_id),
148 foreign key (type_id) references ttrss_prefs_types(id),
149 index(section_id),
150 foreign key (section_id) references ttrss_prefs_sections(id)) TYPE=InnoDB;
151
a6ccf566 152insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_FEED_ICONS', 1, 'true', 'Enable icons in feedlist',2);
a6ccf566
AD
153insert 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);
154insert 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);
155insert 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);
156insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('ENABLE_LABELS', 1, 'false', 'Enable labels',3,
157 '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.');
158
159insert 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);
160insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('DISPLAY_HEADER', 1, 'true', 'Display header',2);
161insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('DISPLAY_FOOTER', 1, 'true', 'Display footer',2);
162insert 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);
163insert 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,
164 'Default limit for articles to display, any custom number you like (0 - disables).');
165
166insert 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,
167 'Updates to all feeds will only run when the backend script is invoked with a "daemon" option on the URI stem.');
168
169insert 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,
170 'Display separate dropbox for feedlist actions, if disabled these actions are available in global actions menu.');
171
172insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_SPLASH', 1, 'false', 'Enable loading splashscreen',2);
173
71604ca4
AD
174insert 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,
175 'This option is useful when you are reading several planet-type aggregators with partially colliding userbase.
14c8eca7 176 When disabled, it forces same posts from different feeds to appear only once.');
71604ca4 177
a6ccf566
AD
178create table ttrss_user_prefs (
179 owner_uid integer not null,
180 pref_name varchar(250),
181 value text not null,
182 index (owner_uid),
183 foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE,
184 index (pref_name),
185 foreign key (pref_name) references ttrss_prefs(pref_name) ON DELETE CASCADE) TYPE=InnoDB;
186
5f171894 187