|
@@ -1,4 +1,4 @@
|
|
-# Copyright (C) 2012-2015 Internet Systems Consortium.
|
|
|
|
|
|
+# Copyright (C) 2012-2016 Internet Systems Consortium.
|
|
#
|
|
#
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
# 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
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
@@ -395,6 +395,43 @@ SET version = '4', minor = '1';
|
|
|
|
|
|
# This line concludes database upgrade to version 4.1.
|
|
# This line concludes database upgrade to version 4.1.
|
|
|
|
|
|
|
|
+# Update index used for searching DHCPv4 reservations by identifier and subnet id.
|
|
|
|
+# This index is now unique (to prevent duplicates) and includes DHCPv4 subnet
|
|
|
|
+# identifier.
|
|
|
|
+DROP INDEX key_dhcp4_identifier_subnet_id ON hosts;
|
|
|
|
+CREATE UNIQUE INDEX key_dhcp4_identifier_subnet_id ON hosts (dhcp_identifier ASC , dhcp_identifier_type ASC , dhcp4_subnet_id ASC);
|
|
|
|
+
|
|
|
|
+# Update index used for searching DHCPv6 reservations by identifier and subnet id.
|
|
|
|
+# This index is now unique to prevent duplicates.
|
|
|
|
+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 a table mapping host identifiers to their names. Values in this
|
|
|
|
+# table are used as a foreign key in hosts table to guarantee that only
|
|
|
|
+# identifiers present in host_identifier_type table are used in hosts
|
|
|
|
+# table.
|
|
|
|
+CREATE TABLE IF NOT EXISTS host_identifier_type (
|
|
|
|
+ type TINYINT PRIMARY KEY NOT NULL, # Lease type code.
|
|
|
|
+ name VARCHAR(32) # Name of the lease 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
|
|
|
|
+COMMIT;
|
|
|
|
+
|
|
|
|
+# Add a constraint that any identifier type value added to the hosts
|
|
|
|
+# must map to a value in the host_identifier_type table.
|
|
|
|
+ALTER TABLE hosts
|
|
|
|
+ ADD CONSTRAINT fk_host_identifier_type FOREIGN KEY (dhcp_identifier_type)
|
|
|
|
+ REFERENCES host_identifier_type (type);
|
|
|
|
+
|
|
|
|
+# Update the schema version number
|
|
|
|
+UPDATE schema_version
|
|
|
|
+SET version = '4', minor = '2';
|
|
|
|
+# This line concludes database upgrade to version 4.2.
|
|
|
|
+
|
|
# Notes:
|
|
# Notes:
|
|
#
|
|
#
|
|
# Indexes
|
|
# Indexes
|