diff --git a/installer/data/mysql/atomicupdate/bug_14570.perl b/installer/data/mysql/atomicupdate/bug_14570.perl index 967fd34a21..c266c9b669 100644 --- a/installer/data/mysql/atomicupdate/bug_14570.perl +++ b/installer/data/mysql/atomicupdate/bug_14570.perl @@ -10,6 +10,7 @@ if( CheckVersion( $DBversion ) ) { guarantee_id INT(11) NOT NULL, relationship VARCHAR(100) NOT NULL, PRIMARY KEY (id), + UNIQUE KEY `guarantor_guarantee_idx` ( `guarantor_id`, `guarantee_id` ), CONSTRAINT r_guarantor FOREIGN KEY ( guarantor_id ) REFERENCES borrowers ( borrowernumber ) ON UPDATE CASCADE ON DELETE CASCADE, CONSTRAINT r_guarantee FOREIGN KEY ( guarantee_id ) REFERENCES borrowers ( borrowernumber ) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index d28822ca0a..cd7d7dfbcc 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -4080,6 +4080,7 @@ CREATE TABLE `borrower_relationships` ( guarantee_id INT(11) NOT NULL, relationship VARCHAR(100) NOT NULL, PRIMARY KEY (id), + UNIQUE KEY `guarantor_guarantee_idx` ( `guarantor_id`, `guarantee_id` ), CONSTRAINT r_guarantor FOREIGN KEY ( guarantor_id ) REFERENCES borrowers ( borrowernumber ) ON UPDATE CASCADE ON DELETE CASCADE, CONSTRAINT r_guarantee FOREIGN KEY ( guarantee_id ) REFERENCES borrowers ( borrowernumber ) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;