https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30414

            Bug ID: 30414
           Summary: Inconsistent (duplicated) FK constraint name:
                    aqbudgets.aqbudgetperiods_ibfk_1
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P5 - low
         Component: Database
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]

CREATE TABLE `aqbudgets` (
[etc]
  CONSTRAINT `aqbudgetperiods_ibfk_1` FOREIGN KEY (`budget_period_id`)
REFERENCES `aqbudgetperiods` (`budget_period_id`) ON DELETE CASCADE ON UPDATE
CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Normally, our constraints have the prefix showing the source table not the
destination (aqbudgetperiods) like here.

DBrev20.06.00.055 contained this:
    if ( !foreign_key_exists( 'aqbudgets', 'aqbudgetperiods_ibfk_1' ) ) {
        $dbh->do(q|
            ALTER TABLE aqbudgets ADD CONSTRAINT `aqbudgetperiods_ibfk_1`
FOREIGN KEY (`budget_period_id`) REFERENCES `aqbudgetperiods`
(`budget_period_id`) ON UPDATE CASCADE ON DELETE CASCADE
        |);

This created aqbudgetperiods_ibfk_1 next to aqbudgets_ifbk_1 that we already
had in our production table.
Note that DBrev 3.01.00.077 already contained that one:
ALTER TABLE `aqbudgets`
   ADD CONSTRAINT `aqbudgets_ifbk_1` FOREIGN KEY (`budget_period_id`)
REFERENCES `aqbudgetperiods` (`budget_period_id`) ON DELETE CASCADE ON UPDATE
CASCADE

Conclusion: Older Koha database may contain a duplicated FK constraint.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to