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