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

(-)a/installer/data/mysql/atomicupdate/bug_32162.pl (+24 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "31162",
5
    description => "Add primary key to erm_eholdings_packages_agreements",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        unless ( primary_key_exists('erm_eholdings_packages_agreements') ){
10
            $dbh->do(q{
11
                ALTER TABLE erm_eholdings_packages_agreements
12
                DROP FOREIGN KEY erm_eholdings_packages_agreements_ibfk_1,
13
                DROP FOREIGN KEY erm_eholdings_packages_agreements_ibfk_2,
14
                DROP CONSTRAINT erm_eholdings_packages_agreements_uniq,
15
                ADD PRIMARY KEY(`package_id`, `agreement_id`)
16
            });
17
            $dbh->do(q{
18
                ALTER TABLE erm_eholdings_packages_agreements
19
                ADD CONSTRAINT `erm_eholdings_packages_agreements_ibfk_1` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
20
                ADD CONSTRAINT `erm_eholdings_packages_agreements_ibfk_2` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
21
            });
22
        }
23
    },
24
};
(-)a/installer/data/mysql/kohastructure.sql (-3 / +2 lines)
Lines 2975-2983 DROP TABLE IF EXISTS `erm_eholdings_packages_agreements`; Link Here
2975
CREATE TABLE `erm_eholdings_packages_agreements` (
2975
CREATE TABLE `erm_eholdings_packages_agreements` (
2976
    `package_id` INT(11) NOT NULL COMMENT 'link to the package',
2976
    `package_id` INT(11) NOT NULL COMMENT 'link to the package',
2977
    `agreement_id` INT(11) NOT NULL COMMENT 'link to the agreement',
2977
    `agreement_id` INT(11) NOT NULL COMMENT 'link to the agreement',
2978
    UNIQUE KEY `erm_eholdings_packages_agreements_uniq` (`package_id`, `agreement_id`),
2979
    CONSTRAINT `erm_eholdings_packages_agreements_ibfk_1` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2978
    CONSTRAINT `erm_eholdings_packages_agreements_ibfk_1` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2980
    CONSTRAINT `erm_eholdings_packages_agreements_ibfk_2` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
2979
    CONSTRAINT `erm_eholdings_packages_agreements_ibfk_2` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2980
    PRIMARY KEY(`package_id`, `agreement_id`)
2981
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2981
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2982
2982
2983
--
2983
--
2984
- 

Return to bug 32162