summaryrefslogtreecommitdiffstats
path: root/src/share/database/scripts/mysql/dhcpdb_create.mysql
diff options
context:
space:
mode:
authorAndrei Pavel <andrei.pavel@qualitance.com>2017-08-17 19:54:15 +0200
committerAndrei Pavel <andrei.pavel@qualitance.com>2017-08-17 19:54:15 +0200
commita8f6403d1b44f62ebb3dd3085e401b46767003a0 (patch)
tree00df52bd413b27ed04097164021251f8e8ec6c80 /src/share/database/scripts/mysql/dhcpdb_create.mysql
parentRemoved duplicate include (diff)
parent[master] Added ChangeLog 1288 for trac 5315. (diff)
downloadkea-a8f6403d1b44f62ebb3dd3085e401b46767003a0.tar.xz
kea-a8f6403d1b44f62ebb3dd3085e401b46767003a0.zip
Merge branch 'isc-master' into config-h
Diffstat (limited to 'src/share/database/scripts/mysql/dhcpdb_create.mysql')
-rw-r--r--src/share/database/scripts/mysql/dhcpdb_create.mysql38
1 files changed, 31 insertions, 7 deletions
diff --git a/src/share/database/scripts/mysql/dhcpdb_create.mysql b/src/share/database/scripts/mysql/dhcpdb_create.mysql
index 552c16bda6..bb82fc33dd 100644
--- a/src/share/database/scripts/mysql/dhcpdb_create.mysql
+++ b/src/share/database/scripts/mysql/dhcpdb_create.mysql
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2016 Internet Systems Consortium.
+# Copyright (C) 2012-2017 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -26,7 +26,7 @@
# is initialized to 1.0, then upgraded to 2.0 etc. This may be somewhat
# sub-optimal, but it ensues consistency with upgrade scripts. (It is much
# easier to maintain init and upgrade scripts if they look the same).
-# Since initialization is done only once, it's perfromance is not an issue.
+# Since initialization is done only once, it's performance is not an issue.
# This line starts database initialization to 1.0.
@@ -103,7 +103,7 @@ START TRANSACTION;
INSERT INTO schema_version VALUES (1, 0);
COMMIT;
-# This line concludes database initalization to version 1.0.
+# This line concludes database initialization to version 1.0.
# This line starts database upgrade to version 2.0.
ALTER TABLE lease6
@@ -402,7 +402,7 @@ DROP INDEX key_dhcp6_identifier_subnet_id ON hosts;
CREATE UNIQUE INDEX key_dhcp6_identifier_subnet_id ON hosts (dhcp_identifier ASC , dhcp_identifier_type ASC , dhcp6_subnet_id ASC);
# Create index to search for reservations using IP address and subnet id.
-# This unique index guarantees that there is only one occurence of the
+# This unique index guarantees that there is only one occurrence of the
# particular IPv4 address for a given subnet.
CREATE UNIQUE INDEX key_dhcp4_ipv4_address_subnet_id ON hosts (ipv4_address ASC , dhcp4_subnet_id ASC);
@@ -420,9 +420,9 @@ CREATE TABLE IF NOT EXISTS host_identifier_type (
) ENGINE = INNODB;
START TRANSACTION;
-INSERT INTO host_identifier_type VALUES (0, 'hw-address'); # Non-temporary v6 addresses
-INSERT INTO host_identifier_type VALUES (1, 'duid'); # Temporary v6 addresses
-INSERT INTO host_identifier_type VALUES (2, 'circuit-id'); # Prefix delegations
+INSERT INTO host_identifier_type VALUES (0, 'hw-address');
+INSERT INTO host_identifier_type VALUES (1, 'duid');
+INSERT INTO host_identifier_type VALUES (2, 'circuit-id');
COMMIT;
# Add a constraint that any identifier type value added to the hosts
@@ -480,6 +480,30 @@ UPDATE schema_version
SET version = '5', minor = '0';
# This line concludes database upgrade to version 5.0.
+# Add missing 'client-id' and new 'flex-id' host identifier types.
+INSERT INTO host_identifier_type VALUES (3, 'client-id');
+INSERT INTO host_identifier_type VALUES (4, 'flex-id');
+
+# Recreate the trigger removing dependent host entries.
+DROP TRIGGER host_BDEL;
+
+DELIMITER $$
+CREATE TRIGGER host_BDEL BEFORE DELETE ON hosts FOR EACH ROW
+-- Edit trigger body code below this line. Do not edit lines above this one
+BEGIN
+DELETE FROM ipv6_reservations WHERE ipv6_reservations.host_id = OLD.host_id;
+DELETE FROM dhcp4_options WHERE dhcp4_options.host_id = OLD.host_id;
+DELETE FROM dhcp6_options WHERE dhcp6_options.host_id = OLD.host_id;
+END
+$$
+DELIMITER ;
+
+
+# Update the schema version number
+UPDATE schema_version
+SET version = '5', minor = '1';
+# This line concludes database upgrade to version 5.1.
+
# Notes:
#
# Indexes