@@ -, +, @@ --- installer/data/mysql/kohastructure.sql | 8 +++++++- installer/data/mysql/updatedatabase.pl | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletions(-) --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -479,11 +479,17 @@ CREATE TABLE collections ( colId integer(11) NOT NULL auto_increment, colTitle varchar(100) NOT NULL DEFAULT '', colDesc text NOT NULL, - colBranchcode varchar(4) DEFAULT NULL comment 'branchcode for branch where item should be held.', + colBranchcode varchar(10) DEFAULT NULL comment 'branchcode for branch where item should be held.', PRIMARY KEY (colId) ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8; -- +-- Constraints for table `collections` +-- +ALTER TABLE `collections` + ADD CONSTRAINT `collections_ibfk_1` FOREIGN KEY (`colBranchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- -- Table: collections_tracking -- DROP TABLE IF EXISTS collections_tracking; --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -8465,6 +8465,22 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.17.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do(q{ + ALTER TABLE collections CHANGE colBranchcode colBranchcode VARCHAR( 10 ) NULL DEFAULT NULL + }); + $dbh->do(q{ + ALTER TABLE collections ADD INDEX ( colBranchcode ) + }); + $dbh->do(q{ + ALTER TABLE collections + ADD CONSTRAINT collections_ibfk_1 FOREIGN KEY (colBranchcode) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE + }); + print "Upgrade to $DBversion done (Bug 8836 - Resurrect Rotating Collections)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) --