From fecd57c8861ebf5d213e1e85581ae4fc88ee0407 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 24 Feb 2007 17:46:39 +0100 Subject: [PATCH] add new-style schema versions and updater --- schema/versions/mysql/10.sql | 12 +++ schema/versions/mysql/11.sql | 18 +++++ schema/versions/mysql/12.sql | 12 +++ schema/versions/mysql/13.sql | 6 ++ schema/versions/mysql/3.sql | 43 +++++++++++ schema/versions/mysql/4.sql | 17 +++++ schema/versions/mysql/5.sql | 12 +++ schema/versions/mysql/6.sql | 20 +++++ schema/versions/mysql/7.sql | 19 +++++ schema/versions/mysql/8.sql | 14 ++++ schema/versions/mysql/9.sql | 29 +++++++ schema/versions/pgsql/10.sql | 12 +++ schema/versions/pgsql/11.sql | 18 +++++ schema/versions/pgsql/12.sql | 15 ++++ schema/versions/pgsql/13.sql | 10 +++ schema/versions/pgsql/3.sql | 43 +++++++++++ schema/versions/pgsql/4.sql | 17 +++++ schema/versions/pgsql/5.sql | 10 +++ schema/versions/pgsql/6.sql | 24 ++++++ schema/versions/pgsql/7.sql | 22 ++++++ schema/versions/pgsql/8.sql | 17 +++++ schema/versions/pgsql/9.sql | 33 ++++++++ update.css | 7 ++ update.php | 142 +++++++++++++++++++++++++++++++++++ 24 files changed, 572 insertions(+) create mode 100644 schema/versions/mysql/10.sql create mode 100644 schema/versions/mysql/11.sql create mode 100644 schema/versions/mysql/12.sql create mode 100644 schema/versions/mysql/13.sql create mode 100644 schema/versions/mysql/3.sql create mode 100644 schema/versions/mysql/4.sql create mode 100644 schema/versions/mysql/5.sql create mode 100644 schema/versions/mysql/6.sql create mode 100644 schema/versions/mysql/7.sql create mode 100644 schema/versions/mysql/8.sql create mode 100644 schema/versions/mysql/9.sql create mode 100644 schema/versions/pgsql/10.sql create mode 100644 schema/versions/pgsql/11.sql create mode 100644 schema/versions/pgsql/12.sql create mode 100644 schema/versions/pgsql/13.sql create mode 100644 schema/versions/pgsql/3.sql create mode 100644 schema/versions/pgsql/4.sql create mode 100644 schema/versions/pgsql/5.sql create mode 100644 schema/versions/pgsql/6.sql create mode 100644 schema/versions/pgsql/7.sql create mode 100644 schema/versions/pgsql/8.sql create mode 100644 schema/versions/pgsql/9.sql create mode 100644 update.css create mode 100644 update.php diff --git a/schema/versions/mysql/10.sql b/schema/versions/mysql/10.sql new file mode 100644 index 000000000..e951f482f --- /dev/null +++ b/schema/versions/mysql/10.sql @@ -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; + diff --git a/schema/versions/mysql/11.sql b/schema/versions/mysql/11.sql new file mode 100644 index 000000000..690b978eb --- /dev/null +++ b/schema/versions/mysql/11.sql @@ -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; diff --git a/schema/versions/mysql/12.sql b/schema/versions/mysql/12.sql new file mode 100644 index 000000000..73af4e375 --- /dev/null +++ b/schema/versions/mysql/12.sql @@ -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; + diff --git a/schema/versions/mysql/13.sql b/schema/versions/mysql/13.sql new file mode 100644 index 000000000..ad068c8a2 --- /dev/null +++ b/schema/versions/mysql/13.sql @@ -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; diff --git a/schema/versions/mysql/3.sql b/schema/versions/mysql/3.sql new file mode 100644 index 000000000..79860a29c --- /dev/null +++ b/schema/versions/mysql/3.sql @@ -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; diff --git a/schema/versions/mysql/4.sql b/schema/versions/mysql/4.sql new file mode 100644 index 000000000..6dfc5f82f --- /dev/null +++ b/schema/versions/mysql/4.sql @@ -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; diff --git a/schema/versions/mysql/5.sql b/schema/versions/mysql/5.sql new file mode 100644 index 000000000..e3ddb0357 --- /dev/null +++ b/schema/versions/mysql/5.sql @@ -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; diff --git a/schema/versions/mysql/6.sql b/schema/versions/mysql/6.sql new file mode 100644 index 000000000..1018bcf4d --- /dev/null +++ b/schema/versions/mysql/6.sql @@ -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; + diff --git a/schema/versions/mysql/7.sql b/schema/versions/mysql/7.sql new file mode 100644 index 000000000..bee135989 --- /dev/null +++ b/schema/versions/mysql/7.sql @@ -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; + diff --git a/schema/versions/mysql/8.sql b/schema/versions/mysql/8.sql new file mode 100644 index 000000000..39100450b --- /dev/null +++ b/schema/versions/mysql/8.sql @@ -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; + diff --git a/schema/versions/mysql/9.sql b/schema/versions/mysql/9.sql new file mode 100644 index 000000000..546adc2d7 --- /dev/null +++ b/schema/versions/mysql/9.sql @@ -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; + diff --git a/schema/versions/pgsql/10.sql b/schema/versions/pgsql/10.sql new file mode 100644 index 000000000..764b4b763 --- /dev/null +++ b/schema/versions/pgsql/10.sql @@ -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; + diff --git a/schema/versions/pgsql/11.sql b/schema/versions/pgsql/11.sql new file mode 100644 index 000000000..690b978eb --- /dev/null +++ b/schema/versions/pgsql/11.sql @@ -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; diff --git a/schema/versions/pgsql/12.sql b/schema/versions/pgsql/12.sql new file mode 100644 index 000000000..6de90f1ab --- /dev/null +++ b/schema/versions/pgsql/12.sql @@ -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; diff --git a/schema/versions/pgsql/13.sql b/schema/versions/pgsql/13.sql new file mode 100644 index 000000000..bf2a2b438 --- /dev/null +++ b/schema/versions/pgsql/13.sql @@ -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; diff --git a/schema/versions/pgsql/3.sql b/schema/versions/pgsql/3.sql new file mode 100644 index 000000000..5b23f3366 --- /dev/null +++ b/schema/versions/pgsql/3.sql @@ -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; diff --git a/schema/versions/pgsql/4.sql b/schema/versions/pgsql/4.sql new file mode 100644 index 000000000..1f926eaeb --- /dev/null +++ b/schema/versions/pgsql/4.sql @@ -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; diff --git a/schema/versions/pgsql/5.sql b/schema/versions/pgsql/5.sql new file mode 100644 index 000000000..1292daa3c --- /dev/null +++ b/schema/versions/pgsql/5.sql @@ -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; diff --git a/schema/versions/pgsql/6.sql b/schema/versions/pgsql/6.sql new file mode 100644 index 000000000..6c406495d --- /dev/null +++ b/schema/versions/pgsql/6.sql @@ -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; diff --git a/schema/versions/pgsql/7.sql b/schema/versions/pgsql/7.sql new file mode 100644 index 000000000..51437e4fa --- /dev/null +++ b/schema/versions/pgsql/7.sql @@ -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; diff --git a/schema/versions/pgsql/8.sql b/schema/versions/pgsql/8.sql new file mode 100644 index 000000000..ab7a7df33 --- /dev/null +++ b/schema/versions/pgsql/8.sql @@ -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; diff --git a/schema/versions/pgsql/9.sql b/schema/versions/pgsql/9.sql new file mode 100644 index 000000000..9624403aa --- /dev/null +++ b/schema/versions/pgsql/9.sql @@ -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; + diff --git a/update.css b/update.css new file mode 100644 index 000000000..d3c2890fc --- /dev/null +++ b/update.css @@ -0,0 +1,7 @@ +p.warning { + color : red; +} + +p.query { + color : green; +} diff --git a/update.php b/update.php new file mode 100644 index 000000000..964626d7f --- /dev/null +++ b/update.php @@ -0,0 +1,142 @@ + + + + + Database Updater + + + + + + +

Database Updater

+ +Warning: Please backup your database before proceeding.

"; + + print "

Your database schema version is $version. Latest version is ". + "$latest_version.

"; + + print "

Available incremental updates:"; + + foreach (array_keys($update_versions) as $v) { + if ($v > $version) { + print " $v"; + } + } + + print "

"; + print "Click here to perform updates."; + + } else if ($op == "do") { + + print "

Performing updates (version: $version)...

"; + + $num_updates = 0; + + foreach (array_keys($update_versions) as $v) { + if ($v == $version + 1) { + print "

Updating to version $v...

"; + $fp = fopen($update_versions[$v], "r"); + if ($fp) { + while (!feof($fp)) { + $query = trim(getline($fp, ";")); + if ($query != "") { + print "

QUERY: $query

"; + db_query($link, $query); + } + } + } + fclose($fp); + + print "

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 "ERROR!"; + return; + } + + $num_updates++; + } + } + + print "

Finished. Performed $num_updates updates up to schema + version $version.

"; + } +?> + + + + +