[Koha-bugs] [Bug 30414] New: Inconsistent (duplicated) FK constraint name: aqbudgets.aqbudgetperiods_ibfk_1

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Mar 31 14:20:04 CEST 2022


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: koha-bugs at lists.koha-community.org
          Reporter: m.de.rooy at rijksmuseum.nl
        QA Contact: testopia at bugs.koha-community.org

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.


More information about the Koha-bugs mailing list