Bug 17234: Need to separate KEY and FOREIGN KEY checks
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 12 Jan 2017 09:44:46 +0000 (10:44 +0100)
committerJulian Maurice <julian.maurice@biblibre.com>
Thu, 19 Jan 2017 15:36:53 +0000 (16:36 +0100)
commitd0d628c6118256c9c69ccdff4e2e2cde0e7615cd
treec411f5c44bd077a4c5399d4157f23de508bac8ea
parent6086ae2f0b6faf4ed34c4338aab3b885164f4970
Bug 17234: Need to separate KEY and FOREIGN KEY checks

In the previous patch we use the constraint_exists subroutine to verify
if an index or a foreign key exists.
But the `SHOW INDEX` query does not return foreign keys (as its name
suggests!).
We need another subroutine foreign_key_exists to check the FK existence.

I have found that because t/db_dependent/TestBuilder.t fails on
oai_sets_biblios, because oai_sets_biblios_ibfk_1 has not been removed.

Test plan:
0/ Do not apply this patch
1/ Use a 3.20 DB
2/ update the DB
3/ SHOW CREATE TABLE oai_sets_biblios
will display oai_sets_biblios_ibfk_1

Apply the patch and repeat 1, 2, 3
=> Will not display oai_sets_biblios_ibfk_1
It has been removed as expected.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 05fdd855c8da85d3be27d42721f6a544b0145e57)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
(cherry picked from commit ba45608b0d823e4bac4e6794392d53f4eda4b9c2)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
C4/Installer.pm
installer/data/mysql/updatedatabase.pl
t/db_dependent/Installer.t