Bug 24412: kohastructure and atomic update

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Nicolas Legrand 2020-01-13 17:55:46 +01:00 committed by Jonathan Druart
parent 017036f695
commit d87090f3bb
2 changed files with 21 additions and 1 deletions

View file

@ -0,0 +1,16 @@
$DBversion = 'XXX'; # will be replaced by the RM
if( CheckVersion( $DBversion ) ) {
# you can use $dbh here like:
$dbh->do(q{
ALTER TABLE reserves ADD COLUMN desk_id INT(11) DEFAULT NULL AFTER branchcode,
ADD KEY desk_id (`desk_id`),
ADD CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE CASCADE ON UPDATE CASCADE ;
});
$dbh->do(q{
ALTER TABLE old_reserves ADD COLUMN desk_id INT(11) DEFAULT NULL AFTER branchcode,
ADD KEY `old_desk_id` (`desk_id`);
});
SetVersion( $DBversion );
print "Upgrade to $DBversion done (Bug XXXXX - Attach waiting reserve to desk)\n";
}

View file

@ -1762,6 +1762,7 @@ CREATE TABLE `reserves` ( -- information related to holds/reserves in Koha
`reservedate` date default NULL, -- the date the hold was placed
`biblionumber` int(11) NOT NULL default 0, -- foreign key from the biblio table defining which bib record this hold is on
`branchcode` varchar(10) default NULL, -- foreign key from the branches table defining which branch the patron wishes to pick this hold up at
`desk_id` int(11) default NULL, -- foreign key from the desks table defining which desk the patron should pick this hold up at
`notificationdate` date default NULL, -- currently unused
`reminderdate` date default NULL, -- currently unused
`cancellationdate` date default NULL, -- the date this hold was cancelled
@ -1785,12 +1786,14 @@ CREATE TABLE `reserves` ( -- information related to holds/reserves in Koha
KEY `biblionumber` (`biblionumber`),
KEY `itemnumber` (`itemnumber`),
KEY `branchcode` (`branchcode`),
KEY `desk_id` (`desk_id`),
KEY `itemtype` (`itemtype`),
CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE
CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
@ -1804,6 +1807,7 @@ CREATE TABLE `old_reserves` ( -- this table holds all holds/reserves that have b
`reservedate` date default NULL, -- the date the hold was places
`biblionumber` int(11) default NULL, -- foreign key from the biblio table defining which bib record this hold is on
`branchcode` varchar(10) default NULL, -- foreign key from the branches table defining which branch the patron wishes to pick this hold up at
`desk_id` int(11) default NULL, -- foreign key from the desks table defining which desk the patron should pick this hold up at
`notificationdate` date default NULL, -- currently unused
`reminderdate` date default NULL, -- currently unused
`cancellationdate` date default NULL, -- the date this hold was cancelled