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)
committerKyle M Hall <kyle@bywatersolutions.com>
Thu, 12 Jan 2017 12:43:10 +0000 (12:43 +0000)
commit05fdd855c8da85d3be27d42721f6a544b0145e57
tree782e6524cbf3c5b9398a6767067d39a2890d5631
parent1e0becf91586b6a03d2e5681eb63483dc06cd940
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>
C4/Installer.pm
installer/data/mysql/updatedatabase.pl
t/db_dependent/Installer.t