add new-style schema versions and updater
parent
1212419849
commit
fecd57c886
@ -0,0 +1,12 @@
|
|||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('DIGEST_ENABLE', 1, 'false', 'Enable e-mail digest',1,
|
||||||
|
'This option enables sending daily digest of new (and unread) headlines on your configured e-mail address');
|
||||||
|
|
||||||
|
alter table ttrss_feeds add column include_in_digest bool;
|
||||||
|
update ttrss_feeds set include_in_digest = true;
|
||||||
|
alter table ttrss_feeds change include_in_digest include_in_digest bool not null;
|
||||||
|
alter table ttrss_feeds alter column include_in_digest set default true;
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('CONFIRM_FEED_CATCHUP', 1, 'true', 'Confirm marking feed as read',3);
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 10;
|
||||||
|
|
@ -0,0 +1,18 @@
|
|||||||
|
begin;
|
||||||
|
|
||||||
|
delete FROM ttrss_user_prefs WHERE pref_name = 'DISPLAY_HEADER';
|
||||||
|
delete FROM ttrss_user_prefs WHERE pref_name = 'DISPLAY_FOOTER';
|
||||||
|
delete FROM ttrss_user_prefs WHERE pref_name = 'ENABLE_SEARCH_TOOLBAR';
|
||||||
|
delete FROM ttrss_user_prefs WHERE pref_name = 'USE_COMPACT_STYLESHEET';
|
||||||
|
|
||||||
|
delete FROM ttrss_prefs WHERE pref_name = 'DISPLAY_HEADER';
|
||||||
|
delete FROM ttrss_prefs WHERE pref_name = 'DISPLAY_FOOTER';
|
||||||
|
delete FROM ttrss_prefs WHERE pref_name = 'ENABLE_SEARCH_TOOLBAR';
|
||||||
|
delete FROM ttrss_prefs WHERE pref_name = 'USE_COMPACT_STYLESHEET';
|
||||||
|
|
||||||
|
insert into ttrss_themes (theme_name, theme_path) values ('Graycube', 'graycube');
|
||||||
|
insert into ttrss_themes (theme_name, theme_path) values ('Default (Compact)', 'compact');
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 11;
|
||||||
|
|
||||||
|
commit;
|
@ -0,0 +1,12 @@
|
|||||||
|
alter table ttrss_filters add column action_param varchar(200);
|
||||||
|
|
||||||
|
update ttrss_filters set action_param = '';
|
||||||
|
|
||||||
|
alter table ttrss_filters change action_param action_param varchar(200) not null;
|
||||||
|
alter table ttrss_filters alter column action_param set default '';
|
||||||
|
|
||||||
|
insert into ttrss_filter_actions (id,name,description) values (4, 'tag',
|
||||||
|
'Assign tags');
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 12;
|
||||||
|
|
@ -0,0 +1,6 @@
|
|||||||
|
alter table ttrss_filters add column inverse bool;
|
||||||
|
update ttrss_filters set inverse = false;
|
||||||
|
alter table ttrss_filters change inverse inverse bool not null;
|
||||||
|
alter table ttrss_filters alter column inverse set default false;
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 13;
|
@ -0,0 +1,43 @@
|
|||||||
|
begin;
|
||||||
|
|
||||||
|
alter table ttrss_entries add column num_comments integer;
|
||||||
|
|
||||||
|
update ttrss_entries set num_comments = 0;
|
||||||
|
|
||||||
|
alter table ttrss_entries change num_comments num_comments integer not null;
|
||||||
|
alter table ttrss_entries alter column num_comments set default 0;
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('COMBINED_DISPLAY_MODE', 1, 'false', 'Combined feed display',2,
|
||||||
|
'Display expanded list of feed articles, instead of separate displays for headlines and article content');
|
||||||
|
|
||||||
|
alter table ttrss_feed_categories add column collapsed bool;
|
||||||
|
|
||||||
|
update ttrss_feed_categories set collapsed = false;
|
||||||
|
|
||||||
|
alter table ttrss_feed_categories change collapsed collapsed bool not null;
|
||||||
|
alter table ttrss_feed_categories alter column collapsed set default 0;
|
||||||
|
|
||||||
|
alter table ttrss_feeds add column auth_login varchar(250);
|
||||||
|
alter table ttrss_feeds add column auth_pass varchar(250);
|
||||||
|
|
||||||
|
update ttrss_feeds set auth_login = '';
|
||||||
|
update ttrss_feeds set auth_pass = '';
|
||||||
|
|
||||||
|
alter table ttrss_feeds change auth_login auth_login varchar(250) not null;
|
||||||
|
alter table ttrss_feeds alter column auth_login set default '';
|
||||||
|
|
||||||
|
alter table ttrss_feeds change auth_pass auth_pass varchar(250) not null;
|
||||||
|
alter table ttrss_feeds alter column auth_pass set default '';
|
||||||
|
|
||||||
|
alter table ttrss_users add column email varchar(250);
|
||||||
|
|
||||||
|
update ttrss_users set email = '';
|
||||||
|
|
||||||
|
alter table ttrss_users change email email varchar(250) not null;
|
||||||
|
alter table ttrss_users alter column email set default '';
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_SEARCH_TOOLBAR', 1, 'false', 'Enable search toolbar',2);
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 3;
|
||||||
|
|
||||||
|
commit;
|
@ -0,0 +1,17 @@
|
|||||||
|
begin;
|
||||||
|
|
||||||
|
alter table ttrss_feeds add column parent_feed integer;
|
||||||
|
alter table ttrss_feeds add foreign key (parent_feed) references ttrss_feeds(id) on delete set null;
|
||||||
|
|
||||||
|
alter table ttrss_feeds add column private bool;
|
||||||
|
|
||||||
|
update ttrss_feeds set private = false;
|
||||||
|
|
||||||
|
alter table ttrss_feeds change private private bool not null;
|
||||||
|
alter table ttrss_feeds alter column private set default 0;
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('HIDE_READ_FEEDS', 1, 'false', 'Hide feeds with no unread messages',2);
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 4;
|
||||||
|
|
||||||
|
commit;
|
@ -0,0 +1,12 @@
|
|||||||
|
begin;
|
||||||
|
|
||||||
|
create table ttrss_scheduled_updates (id integer not null primary key auto_increment,
|
||||||
|
owner_uid integer not null,
|
||||||
|
feed_id integer default null,
|
||||||
|
entered datetime not null,
|
||||||
|
foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE,
|
||||||
|
foreign key (feed_id) references ttrss_feeds(id) ON DELETE CASCADE) TYPE=InnoDB;
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 5;
|
||||||
|
|
||||||
|
commit;
|
@ -0,0 +1,20 @@
|
|||||||
|
alter table ttrss_entries add column author varchar(250);
|
||||||
|
|
||||||
|
update ttrss_entries set author = '';
|
||||||
|
|
||||||
|
alter table ttrss_entries change author author varchar(250) not null;
|
||||||
|
alter table ttrss_entries alter column author set default '';
|
||||||
|
|
||||||
|
create table ttrss_sessions (id varchar(250) not null primary key,
|
||||||
|
data text,
|
||||||
|
expire integer not null,
|
||||||
|
ip_address varchar(15) not null default '',
|
||||||
|
index (id),
|
||||||
|
index (expire)) TYPE=InnoDB;
|
||||||
|
|
||||||
|
delete from ttrss_prefs where pref_name = 'ENABLE_SPLASH';
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('OPEN_LINKS_IN_NEW_WINDOW', 1, 'true', 'Open article links in new browser window',2);
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 6;
|
||||||
|
|
@ -0,0 +1,19 @@
|
|||||||
|
alter table ttrss_feeds add column rtl_content bool;
|
||||||
|
|
||||||
|
update ttrss_feeds set rtl_content = false;
|
||||||
|
|
||||||
|
alter table ttrss_feeds change rtl_content rtl_content bool not null;
|
||||||
|
alter table ttrss_feeds alter column rtl_content set default false;
|
||||||
|
|
||||||
|
delete from ttrss_user_prefs where pref_name = 'DISPLAY_FEEDLIST_ACTIONS';
|
||||||
|
delete from ttrss_prefs where pref_name = 'DISPLAY_FEEDLIST_ACTIONS';
|
||||||
|
|
||||||
|
delete from ttrss_user_prefs where pref_name = 'ENABLE_PREFS_CATCHUP_UNCATCHUP';
|
||||||
|
delete from ttrss_prefs where pref_name = 'ENABLE_PREFS_CATCHUP_UNCATCHUP';
|
||||||
|
|
||||||
|
alter table ttrss_sessions drop column ip_address;
|
||||||
|
|
||||||
|
alter table ttrss_filters drop column description;
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 7;
|
||||||
|
|
@ -0,0 +1,14 @@
|
|||||||
|
insert into ttrss_themes (theme_name, theme_path) values ('Old-skool', 'compat');
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('ON_CATCHUP_SHOW_NEXT_FEED', 1, 'false', 'On catchup show next feed',2,
|
||||||
|
'When "Mark as read" button is clicked in toolbar, automatically open next feed with unread articles.');
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('FEEDS_SORT_BY_UNREAD', 1, 'false', 'Sort feeds by unread articles count',2);
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('EXTENDED_FEEDLIST', 1, 'false', 'Show additional information in feedlist',2);
|
||||||
|
|
||||||
|
insert into ttrss_filter_actions (id,name,description) values (3, 'mark',
|
||||||
|
'Set starred');
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 8;
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
alter table ttrss_feeds add column hidden bool;
|
||||||
|
update ttrss_feeds set hidden = false;
|
||||||
|
alter table ttrss_feeds change hidden hidden bool not null;
|
||||||
|
alter table ttrss_feeds alter column hidden set default false;
|
||||||
|
|
||||||
|
alter table ttrss_users add column email_digest bool;
|
||||||
|
update ttrss_users set email_digest = false;
|
||||||
|
alter table ttrss_users change email_digest email_digest bool not null;
|
||||||
|
alter table ttrss_users alter column email_digest set default false;
|
||||||
|
|
||||||
|
alter table ttrss_users add column last_digest_sent datetime;
|
||||||
|
update ttrss_users set last_digest_sent = false;
|
||||||
|
alter table ttrss_users alter column last_digest_sent set default null;
|
||||||
|
|
||||||
|
alter table ttrss_filters add column enabled bool;
|
||||||
|
update ttrss_filters set enabled = true;
|
||||||
|
alter table ttrss_filters change enabled enabled bool not null;
|
||||||
|
alter table ttrss_filters alter column enabled set default true;
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('MARK_UNREAD_ON_UPDATE', 1, 'false', 'Set articles as unread on update',3);
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('REVERSE_HEADLINES', 1, 'false', 'Reverse headline order (oldest first)',2);
|
||||||
|
|
||||||
|
update ttrss_prefs SET section_id = 3 WHERE pref_name = 'ENABLE_SEARCH_TOOLBAR';
|
||||||
|
update ttrss_prefs SET section_id = 3 WHERE pref_name = 'ENABLE_FEED_ICONS';
|
||||||
|
update ttrss_prefs SET section_id = 3 WHERE pref_name = 'EXTENDED_FEEDLIST';
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 9;
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('DIGEST_ENABLE', 1, 'false', 'Enable e-mail digest',1,
|
||||||
|
'This option enables sending daily digest of new (and unread) headlines on your configured e-mail address');
|
||||||
|
|
||||||
|
alter table ttrss_feeds add column include_in_digest boolean;
|
||||||
|
update ttrss_feeds set include_in_digest = true;
|
||||||
|
alter table ttrss_feeds alter column include_in_digest set not null;
|
||||||
|
alter table ttrss_feeds alter column include_in_digest set default true;
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('CONFIRM_FEED_CATCHUP', 1, 'true', 'Confirm marking feed as read',3);
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 10;
|
||||||
|
|
@ -0,0 +1,18 @@
|
|||||||
|
begin;
|
||||||
|
|
||||||
|
delete FROM ttrss_user_prefs WHERE pref_name = 'DISPLAY_HEADER';
|
||||||
|
delete FROM ttrss_user_prefs WHERE pref_name = 'DISPLAY_FOOTER';
|
||||||
|
delete FROM ttrss_user_prefs WHERE pref_name = 'ENABLE_SEARCH_TOOLBAR';
|
||||||
|
delete FROM ttrss_user_prefs WHERE pref_name = 'USE_COMPACT_STYLESHEET';
|
||||||
|
|
||||||
|
delete FROM ttrss_prefs WHERE pref_name = 'DISPLAY_HEADER';
|
||||||
|
delete FROM ttrss_prefs WHERE pref_name = 'DISPLAY_FOOTER';
|
||||||
|
delete FROM ttrss_prefs WHERE pref_name = 'ENABLE_SEARCH_TOOLBAR';
|
||||||
|
delete FROM ttrss_prefs WHERE pref_name = 'USE_COMPACT_STYLESHEET';
|
||||||
|
|
||||||
|
insert into ttrss_themes (theme_name, theme_path) values ('Graycube', 'graycube');
|
||||||
|
insert into ttrss_themes (theme_name, theme_path) values ('Default (Compact)', 'compact');
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 11;
|
||||||
|
|
||||||
|
commit;
|
@ -0,0 +1,15 @@
|
|||||||
|
begin;
|
||||||
|
|
||||||
|
alter table ttrss_filters add column action_param varchar(200);
|
||||||
|
|
||||||
|
update ttrss_filters set action_param = '';
|
||||||
|
|
||||||
|
alter table ttrss_filters alter column action_param set not null;
|
||||||
|
alter table ttrss_filters alter column action_param set default '';
|
||||||
|
|
||||||
|
insert into ttrss_filter_actions (id,name,description) values (4, 'tag',
|
||||||
|
'Assign tags');
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 12;
|
||||||
|
|
||||||
|
commit;
|
@ -0,0 +1,10 @@
|
|||||||
|
begin;
|
||||||
|
|
||||||
|
alter table ttrss_filters add column inverse boolean;
|
||||||
|
update ttrss_filters set inverse = false;
|
||||||
|
alter table ttrss_filters alter column inverse set not null;
|
||||||
|
alter table ttrss_filters alter column inverse set default false;
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 13;
|
||||||
|
|
||||||
|
commit;
|
@ -0,0 +1,43 @@
|
|||||||
|
begin;
|
||||||
|
|
||||||
|
alter table ttrss_entries add column num_comments integer;
|
||||||
|
|
||||||
|
update ttrss_entries set num_comments = 0;
|
||||||
|
|
||||||
|
alter table ttrss_entries alter column num_comments set not null;
|
||||||
|
alter table ttrss_entries alter column num_comments set default 0;
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('COMBINED_DISPLAY_MODE', 1, 'false', 'Combined feed display',2,
|
||||||
|
'Display expanded list of feed articles, instead of separate displays for headlines and article content');
|
||||||
|
|
||||||
|
alter table ttrss_feed_categories add column collapsed boolean;
|
||||||
|
|
||||||
|
update ttrss_feed_categories set collapsed = false;
|
||||||
|
|
||||||
|
alter table ttrss_feed_categories alter column collapsed set not null;
|
||||||
|
alter table ttrss_feed_categories alter column collapsed set default false;
|
||||||
|
|
||||||
|
alter table ttrss_feeds add column auth_login varchar(250);
|
||||||
|
alter table ttrss_feeds add column auth_pass varchar(250);
|
||||||
|
|
||||||
|
update ttrss_feeds set auth_login = '';
|
||||||
|
update ttrss_feeds set auth_pass = '';
|
||||||
|
|
||||||
|
alter table ttrss_feeds alter column auth_login set not null;
|
||||||
|
alter table ttrss_feeds alter column auth_login set default '';
|
||||||
|
|
||||||
|
alter table ttrss_feeds alter column auth_pass set not null;
|
||||||
|
alter table ttrss_feeds alter column auth_pass set default '';
|
||||||
|
|
||||||
|
alter table ttrss_users add column email varchar(250);
|
||||||
|
|
||||||
|
update ttrss_users set email = '';
|
||||||
|
|
||||||
|
alter table ttrss_users alter column email set not null;
|
||||||
|
alter table ttrss_users alter column email set default '';
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_SEARCH_TOOLBAR', 1, 'false', 'Enable search toolbar',2);
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 3;
|
||||||
|
|
||||||
|
commit;
|
@ -0,0 +1,17 @@
|
|||||||
|
begin;
|
||||||
|
|
||||||
|
alter table ttrss_feeds add column parent_feed integer;
|
||||||
|
alter table ttrss_feeds add foreign key (parent_feed) references ttrss_feeds(id) on delete set null;
|
||||||
|
|
||||||
|
alter table ttrss_feeds add column private boolean;
|
||||||
|
|
||||||
|
update ttrss_feeds set private = false;
|
||||||
|
|
||||||
|
alter table ttrss_feeds alter column private set not null;
|
||||||
|
alter table ttrss_feeds alter column private set default false;
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('HIDE_READ_FEEDS', 1, 'false', 'Hide feeds with no unread messages',2);
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 4;
|
||||||
|
|
||||||
|
commit;
|
@ -0,0 +1,10 @@
|
|||||||
|
begin;
|
||||||
|
|
||||||
|
create table ttrss_scheduled_updates (id serial not null primary key,
|
||||||
|
owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
|
||||||
|
feed_id integer default null references ttrss_feeds(id) ON DELETE CASCADE,
|
||||||
|
entered timestamp not null default NOW());
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 5;
|
||||||
|
|
||||||
|
commit;
|
@ -0,0 +1,24 @@
|
|||||||
|
begin;
|
||||||
|
|
||||||
|
alter table ttrss_entries add column author varchar(250);
|
||||||
|
|
||||||
|
update ttrss_entries set author = '';
|
||||||
|
|
||||||
|
alter table ttrss_entries alter column author set not null;
|
||||||
|
alter table ttrss_entries alter column author set default '';
|
||||||
|
|
||||||
|
create table ttrss_sessions (id varchar(250) unique not null primary key,
|
||||||
|
data text,
|
||||||
|
expire integer not null,
|
||||||
|
ip_address varchar(15) not null default '');
|
||||||
|
|
||||||
|
create index ttrss_sessions_id_index on ttrss_sessions(id);
|
||||||
|
create index ttrss_sessions_expire_index on ttrss_sessions(expire);
|
||||||
|
|
||||||
|
delete from ttrss_prefs where pref_name = 'ENABLE_SPLASH';
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('OPEN_LINKS_IN_NEW_WINDOW', 1, 'true', 'Open article links in new browser window',2);
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 6;
|
||||||
|
|
||||||
|
commit;
|
@ -0,0 +1,22 @@
|
|||||||
|
begin;
|
||||||
|
|
||||||
|
alter table ttrss_feeds add column rtl_content boolean;
|
||||||
|
|
||||||
|
update ttrss_feeds set rtl_content = false;
|
||||||
|
|
||||||
|
alter table ttrss_feeds alter column rtl_content set not null;
|
||||||
|
alter table ttrss_feeds alter column rtl_content set default false;
|
||||||
|
|
||||||
|
alter table ttrss_sessions drop column ip_address;
|
||||||
|
|
||||||
|
delete from ttrss_user_prefs where pref_name = 'DISPLAY_FEEDLIST_ACTIONS';
|
||||||
|
delete from ttrss_prefs where pref_name = 'DISPLAY_FEEDLIST_ACTIONS';
|
||||||
|
|
||||||
|
delete from ttrss_user_prefs where pref_name = 'ENABLE_PREFS_CATCHUP_UNCATCHUP';
|
||||||
|
delete from ttrss_prefs where pref_name = 'ENABLE_PREFS_CATCHUP_UNCATCHUP';
|
||||||
|
|
||||||
|
alter table ttrss_filters drop column description;
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 7;
|
||||||
|
|
||||||
|
commit;
|
@ -0,0 +1,17 @@
|
|||||||
|
begin;
|
||||||
|
|
||||||
|
insert into ttrss_themes (theme_name, theme_path) values ('Old-skool', 'compat');
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('ON_CATCHUP_SHOW_NEXT_FEED', 1, 'false', 'On catchup show next feed',2,
|
||||||
|
'When "Mark as read" button is clicked in toolbar, automatically open next feed with unread articles.');
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('FEEDS_SORT_BY_UNREAD', 1, 'false', 'Sort feeds by unread articles count',2);
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('EXTENDED_FEEDLIST', 1, 'false', 'Show additional information in feedlist',2);
|
||||||
|
|
||||||
|
insert into ttrss_filter_actions (id,name,description) values (3, 'mark',
|
||||||
|
'Set starred');
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 8;
|
||||||
|
|
||||||
|
commit;
|
@ -0,0 +1,33 @@
|
|||||||
|
begin;
|
||||||
|
|
||||||
|
alter table ttrss_feeds add column hidden boolean;
|
||||||
|
update ttrss_feeds set hidden = false;
|
||||||
|
alter table ttrss_feeds alter column hidden set not null;
|
||||||
|
alter table ttrss_feeds alter column hidden set default false;
|
||||||
|
|
||||||
|
alter table ttrss_users add column email_digest boolean;
|
||||||
|
update ttrss_users set email_digest = false;
|
||||||
|
alter table ttrss_users alter column email_digest set not null;
|
||||||
|
alter table ttrss_users alter column email_digest set default false;
|
||||||
|
|
||||||
|
alter table ttrss_users add column last_digest_sent timestamp;
|
||||||
|
update ttrss_users set last_digest_sent = NULL;
|
||||||
|
alter table ttrss_users alter column last_digest_sent set default NULL;
|
||||||
|
|
||||||
|
alter table ttrss_filters add column enabled boolean;
|
||||||
|
update ttrss_filters set enabled = true;
|
||||||
|
alter table ttrss_filters alter column enabled set not null;
|
||||||
|
alter table ttrss_filters alter column enabled set default true;
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('MARK_UNREAD_ON_UPDATE', 1, 'false', 'Set articles as unread on update',3);
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('REVERSE_HEADLINES', 1, 'false', 'Reverse headline order (oldest first)',2);
|
||||||
|
|
||||||
|
update ttrss_prefs SET section_id = 3 WHERE pref_name = 'ENABLE_SEARCH_TOOLBAR';
|
||||||
|
update ttrss_prefs SET section_id = 3 WHERE pref_name = 'ENABLE_FEED_ICONS';
|
||||||
|
update ttrss_prefs SET section_id = 3 WHERE pref_name = 'EXTENDED_FEEDLIST';
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 9;
|
||||||
|
|
||||||
|
commit;
|
||||||
|
|
@ -0,0 +1,7 @@
|
|||||||
|
p.warning {
|
||||||
|
color : red;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.query {
|
||||||
|
color : green;
|
||||||
|
}
|
@ -0,0 +1,142 @@
|
|||||||
|
<?php
|
||||||
|
require_once "sessions.php";
|
||||||
|
|
||||||
|
require_once "sanity_check.php";
|
||||||
|
require_once "functions.php";
|
||||||
|
require_once "config.php";
|
||||||
|
require_once "db.php";
|
||||||
|
|
||||||
|
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
||||||
|
|
||||||
|
if (DB_TYPE == "pgsql") {
|
||||||
|
pg_query($link, "set client_encoding = 'utf-8'");
|
||||||
|
pg_set_client_encoding("UNICODE");
|
||||||
|
}
|
||||||
|
|
||||||
|
login_sequence($link);
|
||||||
|
|
||||||
|
$owner_uid = $_SESSION["uid"];
|
||||||
|
|
||||||
|
if ($_SESSION["access_level"] < 10) {
|
||||||
|
header("Location: login.php"); die;
|
||||||
|
}
|
||||||
|
|
||||||
|
define('SCHEMA_VERSION', 13);
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Database Updater</title>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link rel="stylesheet" type="text/css" href="update.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1>Database Updater</h1>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
function getline($fp, $delim) {
|
||||||
|
$result = "";
|
||||||
|
while(!feof($fp)) {
|
||||||
|
$tmp = fgetc($fp);
|
||||||
|
|
||||||
|
if($tmp == $delim) {
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
$result .= $tmp;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
$op = $_REQUEST["op"];
|
||||||
|
|
||||||
|
$result = db_query($link, "SELECT schema_version FROM ttrss_version");
|
||||||
|
$version = db_fetch_result($result, 0, "schema_version");
|
||||||
|
|
||||||
|
$update_files = glob("schema/versions/".DB_TYPE."/*sql");
|
||||||
|
$update_versions = array();
|
||||||
|
|
||||||
|
foreach ($update_files as $f) {
|
||||||
|
$m = array();
|
||||||
|
preg_match_all("/schema\/versions\/".DB_TYPE."\/(\d*)\.sql/", $f, $m,
|
||||||
|
PREG_PATTERN_ORDER);
|
||||||
|
|
||||||
|
if ($m[1][0]) {
|
||||||
|
$update_versions[$m[1][0]] = $f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ksort($update_versions, SORT_NUMERIC);
|
||||||
|
|
||||||
|
$latest_version = max(array_keys($update_versions));
|
||||||
|
|
||||||
|
if ($version == $latest_version) {
|
||||||
|
print "Database schema is up to date (version $version).";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$op) {
|
||||||
|
print "<p class='warning'><b>Warning:</b> Please backup your database before proceeding.</p>";
|
||||||
|
|
||||||
|
print "<p>Your database schema version is $version. Latest version is ".
|
||||||
|
"$latest_version.</p>";
|
||||||
|
|
||||||
|
print "<p>Available incremental updates:";
|
||||||
|
|
||||||
|
foreach (array_keys($update_versions) as $v) {
|
||||||
|
if ($v > $version) {
|
||||||
|
print " <a href='$update_versions[$v]'>$v</a>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</p>";
|
||||||
|
print "<a href='update.php?op=do'>Click here to perform updates.</a>";
|
||||||
|
|
||||||
|
} else if ($op == "do") {
|
||||||
|
|
||||||
|
print "<p>Performing updates (version: $version)...</p>";
|
||||||
|
|
||||||
|
$num_updates = 0;
|
||||||
|
|
||||||
|
foreach (array_keys($update_versions) as $v) {
|
||||||
|
if ($v == $version + 1) {
|
||||||
|
print "<p>Updating to version $v...</p>";
|
||||||
|
$fp = fopen($update_versions[$v], "r");
|
||||||
|
if ($fp) {
|
||||||
|
while (!feof($fp)) {
|
||||||
|
$query = trim(getline($fp, ";"));
|
||||||
|
if ($query != "") {
|
||||||
|
print "<p class='query'><b>QUERY:</b> $query</p>";
|
||||||
|
db_query($link, $query);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose($fp);
|
||||||
|
|
||||||
|
print "<p>Checking version... ";
|
||||||
|
|
||||||
|
$result = db_query($link, "SELECT schema_version FROM ttrss_version");
|
||||||
|
$version = db_fetch_result($result, 0, "schema_version");
|
||||||
|
|
||||||
|
if ($version == $v) {
|
||||||
|
print "OK!";
|
||||||
|
} else {
|
||||||
|
print "<b>ERROR!</b>";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$num_updates++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<p>Finished. Performed $num_updates updates up to schema
|
||||||
|
version $version.</p>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue