@@ -, +, @@ --- installer/data/mysql/atomicupdate/bug_9988b_table.perl | 14 ++++++++++++++ installer/data/mysql/kohastructure.sql | 11 ++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_9988b_table.perl --- a/installer/data/mysql/atomicupdate/bug_9988b_table.perl +++ a/installer/data/mysql/atomicupdate/bug_9988b_table.perl @@ -0,0 +1,14 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do( +q|ALTER TABLE need_merge_authorities +ADD COLUMN authid_new BIGINT AFTER authid, +ADD COLUMN reportxml text AFTER authid_new, +ADD COLUMN timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;| + ); + + $dbh->do( q|UPDATE need_merge_authorities SET authid_new=authid WHERE done<>1| ); + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 9988 - Alter table need_merge_authorities)\n"; +} --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -1255,10 +1255,15 @@ 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` bigint NOT NULL, -- reference to original authority record + `authid_new` bigint, -- reference to optional new authority record + `reportxml` text, -- xml showing original reporting tag + `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- date and time last modified + `done` tinyint DEFAULT 0 -- indication whether merge has been executed (0=not done, 1=done, 2=in progress) +-- Note: authid and authid_new should NOT be FOREIGN keys ! +-- authid may have been deleted; authid_new may be zero ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- --