2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-08 01:45:15 +00:00

[4281] Added scope_id to the MySQL tables holding options.

This commit is contained in:
Marcin Siodelski
2016-05-25 17:52:03 +02:00
parent abfb2c7c1f
commit 6efa4faf3a
4 changed files with 40 additions and 4 deletions

View File

@@ -443,6 +443,33 @@ ALTER TABLE dhcp6_options MODIFY code SMALLINT UNSIGNED NOT NULL;
ALTER TABLE dhcp4_options MODIFY dhcp4_subnet_id INT UNSIGNED NULL;
ALTER TABLE dhcp6_options MODIFY dhcp6_subnet_id INT UNSIGNED NULL;
# Scopes associate DHCP options stored in dhcp4_options and
# dhcp6_options tables with hosts, subnets, classes or indicate
# that they are global options.
CREATE TABLE IF NOT EXISTS dhcp_option_scope (
scope_id TINYINT UNSIGNED PRIMARY KEY NOT NULL,
scope_name VARCHAR(32)
) ENGINE = INNODB;
START TRANSACTION;
INSERT INTO dhcp_option_scope VALUES (0, "global");
INSERT INTO dhcp_option_scope VALUES (1, "subnet");
INSERT INTO dhcp_option_scope VALUES (2, "client-class");
INSERT INTO dhcp_option_scope VALUES (3, "host");
COMMIT;
# Add scopes into table holding DHCPv4 options
ALTER TABLE dhcp4_options ADD COLUMN scope_id TINYINT UNSIGNED NOT NULL;
ALTER TABLE dhcp4_options
ADD CONSTRAINT fk_dhcp4_option_scope FOREIGN KEY (scope_id)
REFERENCES dhcp_option_scope (scope_id);
# Add scopes into table holding DHCPv6 options
ALTER TABLE dhcp6_options ADD COLUMN scope_id TINYINT UNSIGNED NOT NULL;
ALTER TABLE dhcp6_options
ADD CONSTRAINT fk_dhcp6_option_scope FOREIGN KEY (scope_id)
REFERENCES dhcp_option_scope (scope_id);
# Update the schema version number
UPDATE schema_version
SET version = '4', minor = '2';