Browse Source

Bug 24296: Update existing data in the database

This DB udpate adds the stockration states to the trigger enum in the
branchtransfers table and then populates it with any such data currently
contained within the comments field.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
20.05.x
Martin Renvoize 4 years ago
parent
commit
b43a4b2756
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 45
      installer/data/mysql/atomicupdate/bug_24296.perl
  2. 2
      installer/data/mysql/kohastructure.sql

45
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 reason enum
$dbh->do(
qq{
ALTER TABLE
`branchtransfers`
MODIFY COLUMN
`reason` enum(
'Manual',
'StockrotationAdvance',
'StockrotationRepatriation'
)
AFTER `comments`
}
);
# Move stockrotation states to reason field
$dbh->do(
qq{
UPDATE
`branchtransfers`
SET
`reason` = 'StockrotationAdvance',
`comments` = NULL
WHERE
`comments` = 'StockrotationAdvance'
}
);
$dbh->do(
qq{
UPDATE
`branchtransfers`
SET
`reason` = 'StockrotationRepatriation',
`comments` = NULL
WHERE
`comments` = 'StockrotationRepatriation'
}
);
SetVersion( $DBversion );
print "Upgrade to $DBversion done (Bug 24296 - Update stockrotation to use 'reason' field in transfers table)\n";
}

2
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
`reason` ENUM('Manual'), -- what triggered the transfer
`reason` ENUM('Manual', 'StockrotationAdvance', 'StockrotationRepatriation'), -- what triggered the transfer
PRIMARY KEY (`branchtransfer_id`),
KEY `frombranch` (`frombranch`),
KEY `tobranch` (`tobranch`),

Loading…
Cancel
Save