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

(-)a/installer/data/mysql/atomicupdate/bug_30490.pl (+18 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => 30490,
5
    description => "Adjust FK constraint for parent item type",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        if( foreign_key_exists('itemtypes', 'itemtypes_ibfk_1') ) {
10
            $dbh->do(q{
11
alter table itemtypes drop foreign key itemtypes_ibfk_1;
12
            });
13
        }
14
        $dbh->do(q{
15
alter table itemtypes add foreign key itemtypes_ibfk_1 (`parent_type`) REFERENCES `itemtypes` (`itemtype`);
16
        });
17
    },
18
};
(-)a/installer/data/mysql/kohastructure.sql (-2 / +1 lines)
Lines 3344-3350 CREATE TABLE `itemtypes` ( Link Here
3344
  PRIMARY KEY (`itemtype`),
3344
  PRIMARY KEY (`itemtype`),
3345
  UNIQUE KEY `itemtype` (`itemtype`),
3345
  UNIQUE KEY `itemtype` (`itemtype`),
3346
  KEY `itemtypes_ibfk_1` (`parent_type`),
3346
  KEY `itemtypes_ibfk_1` (`parent_type`),
3347
  CONSTRAINT `itemtypes_ibfk_1` FOREIGN KEY (`parent_type`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE
3347
  CONSTRAINT `itemtypes_ibfk_1` FOREIGN KEY (`parent_type`) REFERENCES `itemtypes` (`itemtype`)
3348
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3348
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3349
/*!40101 SET character_set_client = @saved_cs_client */;
3349
/*!40101 SET character_set_client = @saved_cs_client */;
3350
3350
3351
- 

Return to bug 30490