@@ -, +, @@ --- .../data/mysql/atomicupdate/bug_24296.perl | 45 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/bug_24296.perl --- a/installer/data/mysql/atomicupdate/bug_24296.perl +++ a/installer/data/mysql/atomicupdate/bug_24296.perl @@ -0,0 +1,45 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + + # Add stockrotation states to trigger enum + $dbh->do( + qq{ + ALTER TABLE + `branchtransfers` + MODIFY COLUMN + `trigger` enum( + 'MANUAL', + 'StockrotationAdvance', + 'StockrotationRepatriation' + ) + AFTER `comments` + } + ); + + # Move stockrotation states to trigger field + $dbh->do( + qq{ + UPDATE + `branchtransfers` + SET + `trigger` = 'StockrotationAdvance', + `comments` = NULL + WHERE + `comments` = 'StockrotationAdvance' + } + ); + $dbh->do( + qq{ + UPDATE + `branchtransfers` + SET + `trigger` = 'StockrotationRepatriation', + `comments` = NULL + WHERE + `comments` = 'StockrotationRepatriation' + } + ); + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 24296 - Update stockrotation to use 'trigger' field in transfers table)\n"; +} --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -951,7 +951,7 @@ CREATE TABLE `branchtransfers` ( -- information for items that are in transit be `datearrived` datetime default NULL, -- the date the transfer arrived at its destination `tobranch` varchar(10) NOT NULL default '', -- the branch the transfer was going to `comments` LONGTEXT, -- any comments related to the transfer - `trigger` ENUM('MANUAL'), -- what triggered the transfer + `trigger` ENUM('MANUAL', 'StockrotationAdvance', 'StockrotationRepatriation'), -- what triggered the transfer PRIMARY KEY (`branchtransfer_id`), KEY `frombranch` (`frombranch`), KEY `tobranch` (`tobranch`), --