View | Details | Raw Unified | Return to bug 21065
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_21065.perl (+16 lines)
Line 0 Link Here
1
$DBversion = 'XXX';  # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
4
    $dbh->do(q|
5
        ALTER TABLE accountlines DROP FOREIGN KEY accountlines_ibfk_1;
6
    |);
7
    $dbh->do(q|
8
        ALTER TABLE accountlines CHANGE COLUMN borrowernumber borrowernumber INT(11) DEFAULT NULL;
9
    |);
10
    $dbh->do(q|
11
        ALTER TABLE accountlines ADD CONSTRAINT accountlines_ibfk_1 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE SET NULL ON UPDATE CASCADE;
12
    |);
13
14
    SetVersion( $DBversion );
15
    print "Upgrade to $DBversion done (Bug 21065 - Set ON DELETE SET NULL on accountlines.borrowernumber)\n";
16
}
(-)a/installer/data/mysql/kohastructure.sql (-3 / +2 lines)
Lines 2705-2711 DROP TABLE IF EXISTS `accountlines`; Link Here
2705
CREATE TABLE `accountlines` (
2705
CREATE TABLE `accountlines` (
2706
  `accountlines_id` int(11) NOT NULL AUTO_INCREMENT,
2706
  `accountlines_id` int(11) NOT NULL AUTO_INCREMENT,
2707
  `issue_id` int(11) NULL DEFAULT NULL,
2707
  `issue_id` int(11) NULL DEFAULT NULL,
2708
  `borrowernumber` int(11) NOT NULL default 0,
2708
  `borrowernumber` int(11) DEFAULT NULL,
2709
  `accountno` smallint(6) NOT NULL default 0,
2709
  `accountno` smallint(6) NOT NULL default 0,
2710
  `itemnumber` int(11) default NULL,
2710
  `itemnumber` int(11) default NULL,
2711
  `date` date default NULL,
2711
  `date` date default NULL,
Lines 2722-2728 CREATE TABLE `accountlines` ( Link Here
2722
  KEY `acctsborridx` (`borrowernumber`),
2722
  KEY `acctsborridx` (`borrowernumber`),
2723
  KEY `timeidx` (`timestamp`),
2723
  KEY `timeidx` (`timestamp`),
2724
  KEY `itemnumber` (`itemnumber`),
2724
  KEY `itemnumber` (`itemnumber`),
2725
  CONSTRAINT `accountlines_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
2725
  CONSTRAINT `accountlines_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
2726
  CONSTRAINT `accountlines_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL
2726
  CONSTRAINT `accountlines_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL
2727
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2727
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2728
2728
2729
- 

Return to bug 21065