2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 22:15:23 +00:00

[#2063] DROP FOREIGN KEY for MySQL 5 compatibility

This commit is contained in:
Andrei Pavel
2021-08-30 14:55:14 +03:00
parent d9144c5445
commit 48b63d8bf6
2 changed files with 4 additions and 4 deletions

View File

@@ -4018,14 +4018,14 @@ UPDATE schema_version
# Add a constraint that any state value added to the lease4 must
# map to a value in the lease_state table. Note we have to drop
# the foreign keys first, then add them back.
ALTER TABLE lease4 DROP CONSTRAINT fk_lease4_state;
ALTER TABLE lease4 DROP FOREIGN KEY fk_lease4_state;
DROP INDEX lease4_by_state_expire ON lease4;
CREATE INDEX lease4_by_expire_state ON lease4 (expire ASC, state ASC);
ALTER TABLE lease4
ADD CONSTRAINT fk_lease4_state FOREIGN KEY (state)
REFERENCES lease_state (state);
ALTER TABLE lease6 DROP CONSTRAINT fk_lease6_state;
ALTER TABLE lease6 DROP FOREIGN KEY fk_lease6_state;
CREATE INDEX lease6_by_expire_state ON lease6 (expire ASC, state ASC);
DROP INDEX lease6_by_state_expire ON lease6;
ALTER TABLE lease6

View File

@@ -57,14 +57,14 @@ mysql "$@" <<EOF
-- Add a constraint that any state value added to the lease4 must
-- map to a value in the lease_state table. Note we have to drop
-- the foreign keys first, then add them back.
ALTER TABLE lease4 DROP CONSTRAINT fk_lease4_state;
ALTER TABLE lease4 DROP FOREIGN KEY fk_lease4_state;
DROP INDEX lease4_by_state_expire ON lease4;
CREATE INDEX lease4_by_expire_state ON lease4 (expire ASC, state ASC);
ALTER TABLE lease4
ADD CONSTRAINT fk_lease4_state FOREIGN KEY (state)
REFERENCES lease_state (state);
ALTER TABLE lease6 DROP CONSTRAINT fk_lease6_state;
ALTER TABLE lease6 DROP FOREIGN KEY fk_lease6_state;
CREATE INDEX lease6_by_expire_state ON lease6 (expire ASC, state ASC);
DROP INDEX lease6_by_state_expire ON lease6;
ALTER TABLE lease6