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