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

(-)a/installer/data/mysql/atomicupdate/bug_26814_1_add_checkout_type_to_circulation_rules.perl (+21 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
4
    if ( ! column_exists( 'circulation_rules', 'onsite_checkout' ) ) {
5
        $dbh->do( q|
6
            ALTER TABLE circulation_rules ADD COLUMN onsite_checkout INT(1) DEFAULT NULL AFTER branchcode;
7
        | );
8
9
        if ( index_exists( 'circulation_rules', 'branchcode' ) ) {
10
            # we need to drop this forgein key before updating our unique index
11
            $dbh->do( "ALTER TABLE `circulation_rules` DROP FOREIGN KEY circ_rules_ibfk_1;" );
12
            $dbh->do( "ALTER TABLE `circulation_rules` DROP INDEX `branchcode`;" ); # index columns: branchcode, categorycode, itemtype and rule_name
13
            $dbh->do( "ALTER TABLE `circulation_rules` ADD CONSTRAINT circ_rules_ibfk_1 FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE" );
14
            $dbh->do( "ALTER TABLE `circulation_rules` ADD UNIQUE INDEX (`branchcode`,`onsite_checkout`,`categorycode`,`itemtype`,`rule_name`)" );
15
        }
16
    }
17
18
    # Always end with this (adjust the bug info)
19
    SetVersion( $DBversion );
20
    print "Upgrade to $DBversion done (Bug 26814 - Add new circulation rule scope onsite_checkout )\n";
21
}
(-)a/installer/data/mysql/kohastructure.sql (-2 / +2 lines)
Lines 4468-4473 DROP TABLE IF EXISTS `circulation_rules`; Link Here
4468
CREATE TABLE `circulation_rules` (
4468
CREATE TABLE `circulation_rules` (
4469
  `id` int(11) NOT NULL auto_increment,
4469
  `id` int(11) NOT NULL auto_increment,
4470
  `branchcode` varchar(10) NULL default NULL,
4470
  `branchcode` varchar(10) NULL default NULL,
4471
  `onsite_checkout` int(1) NULL default NULL,
4471
  `categorycode` varchar(10) NULL default NULL,
4472
  `categorycode` varchar(10) NULL default NULL,
4472
  `itemtype` varchar(10) NULL default NULL,
4473
  `itemtype` varchar(10) NULL default NULL,
4473
  `rule_name` varchar(32) NOT NULL,
4474
  `rule_name` varchar(32) NOT NULL,
Lines 4477-4483 CREATE TABLE `circulation_rules` ( Link Here
4477
  CONSTRAINT `circ_rules_ibfk_2` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE,
4478
  CONSTRAINT `circ_rules_ibfk_2` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE,
4478
  CONSTRAINT `circ_rules_ibfk_3` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
4479
  CONSTRAINT `circ_rules_ibfk_3` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
4479
  KEY `rule_name` (`rule_name`),
4480
  KEY `rule_name` (`rule_name`),
4480
  UNIQUE (`branchcode`,`categorycode`,`itemtype`,`rule_name`)
4481
  UNIQUE (`branchcode`,`onsite_checkout`,`categorycode`,`itemtype`,`rule_name`)
4481
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4482
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4482
4483
4483
--
4484
--
4484
- 

Return to bug 26814