From 40da57b67e7c24d21f0d025507d474b09cc3598c Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Tue, 14 Feb 2017 08:42:04 +0100 Subject: [PATCH] Bug 9988: Table revision for need_merge_authorities Content-Type: text/plain; charset=utf-8 In order to let merge do exactly the same when called from the merge cron job, we need two additional fields in the table. One existing field is renamed. Test plan: Run the dbrev (updatestructure step in webinstaller). Signed-off-by: Marcel de Rooy Also tested running kohastructure.sql for this table. --- installer/data/mysql/atomicupdate/bug9988b_table.perl | 15 +++++++++++++++ installer/data/mysql/kohastructure.sql | 10 +++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug9988b_table.perl diff --git a/installer/data/mysql/atomicupdate/bug9988b_table.perl b/installer/data/mysql/atomicupdate/bug9988b_table.perl new file mode 100644 index 0000000..ef06e2b --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug9988b_table.perl @@ -0,0 +1,15 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do( +q|ALTER TABLE need_merge_authorities +CHANGE COLUMN authid authid_from BIGINT NOT NULL, +ADD COLUMN authid_to BIGINT NOT NULL AFTER authid_from, +ADD COLUMN reportxml text AFTER authid_to;| + ); + + $dbh->do( q|UPDATE need_merge_authorities SET authid_to=authid_from| ); + + # Always end with this (adjust the bug info) + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 9988 - Alter table need_merge_authorities)\n"; +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 7f405c9..df4dda4 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1252,10 +1252,14 @@ CREATE TABLE `matchchecks` ( -- DROP TABLE IF EXISTS `need_merge_authorities`; -CREATE TABLE `need_merge_authorities` ( -- keeping track of authority records still to be merged by merge_authority cron job (used only if pref dontmerge is ON) +CREATE TABLE `need_merge_authorities` ( -- keeping track of authority records still to be merged by merge_authority cron job `id` int NOT NULL auto_increment PRIMARY KEY, -- unique id - `authid` bigint NOT NULL, -- reference to authority record - `done` tinyint DEFAULT 0 -- indication whether merge has been executed (0=not done, 1= done, 2= in progress) + `authid_from` bigint NOT NULL, -- reference to original authority record + `authid_to` bigint NOT NULL, -- reference to new authority record + `reportxml` text, -- xml showing original reporting tag + `done` tinyint DEFAULT 0 -- indication whether merge has been executed (0=not done, 1= done, >1 in progress) +-- Note: authid_from and authid_to should NOT be FOREIGN keys ! +-- authid_from may have been deleted; authid_to may be zero ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- 2.1.4