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

(-)a/installer/data/mysql/atomicupdate/bug_30451_do_not_delete_orders_with_subscription.pl (+22 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "30451",
5
    description => "Update FK constraint on aqorders.subscriptionid to ON DELETE SET NULL",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        if ( foreign_key_exists( 'aqorders', 'aqorders_subscriptionid' ) ) {
11
            $dbh->do(q{
12
                ALTER TABLE aqorders
13
                DROP FOREIGN KEY aqorders_subscriptionid
14
            });
15
        }
16
        $dbh->do(q{
17
            ALTER TABLE aqorders
18
            ADD CONSTRAINT `aqorders_subscriptionid` FOREIGN KEY (`subscriptionid`) REFERENCES subscription(`subscriptionid`) ON DELETE SET NULL ON UPDATE CASCADE
19
        });
20
        say $out "Update FK constraint on subscriptionid";
21
    },
22
};
(-)a/installer/data/mysql/kohastructure.sql (-2 / +1 lines)
Lines 773-779 CREATE TABLE `aqorders` ( Link Here
773
  CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
773
  CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
774
  CONSTRAINT `aqorders_ibfk_3` FOREIGN KEY (`invoiceid`) REFERENCES `aqinvoices` (`invoiceid`) ON DELETE SET NULL ON UPDATE CASCADE,
774
  CONSTRAINT `aqorders_ibfk_3` FOREIGN KEY (`invoiceid`) REFERENCES `aqinvoices` (`invoiceid`) ON DELETE SET NULL ON UPDATE CASCADE,
775
  CONSTRAINT `aqorders_invoice_currency` FOREIGN KEY (`invoice_currency`) REFERENCES `currency` (`currency`) ON DELETE SET NULL ON UPDATE SET NULL,
775
  CONSTRAINT `aqorders_invoice_currency` FOREIGN KEY (`invoice_currency`) REFERENCES `currency` (`currency`) ON DELETE SET NULL ON UPDATE SET NULL,
776
  CONSTRAINT `aqorders_subscriptionid` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
776
  CONSTRAINT `aqorders_subscriptionid` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE SET NULL ON UPDATE CASCADE
777
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
777
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
778
/*!40101 SET character_set_client = @saved_cs_client */;
778
/*!40101 SET character_set_client = @saved_cs_client */;
779
779
780
- 

Return to bug 30451