From 036b1acaf0549481e4b8fa11b58fcbdbdba3c9df Mon Sep 17 00:00:00 2001 From: Tomek Mrugalski Date: Mon, 31 May 2021 15:33:34 +0200 Subject: [PATCH] [#90] dhcp6_subnet_server table and indexes added --- .../scripts/pgsql/upgrade_6.2_to_7.0.sh.in | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/share/database/scripts/pgsql/upgrade_6.2_to_7.0.sh.in b/src/share/database/scripts/pgsql/upgrade_6.2_to_7.0.sh.in index b2f2952d77..3b99bfbfd9 100644 --- a/src/share/database/scripts/pgsql/upgrade_6.2_to_7.0.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_6.2_to_7.0.sh.in @@ -261,6 +261,28 @@ CREATE INDEX key_dhcp6_server_modification_ts on dhcp6_server (modification_ts); CREATE TRIGGER dhcp6_server_modification_ts_update AFTER UPDATE ON dhcp6_server FOR EACH ROW EXECUTE PROCEDURE modification_ts_update(); + + + + + +CREATE TABLE dhcp6_subnet_server ( + subnet_id BIGINT NOT NULL, + server_id BIGINT NOT NULL, + modification_ts timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (subnet_id, server_id), + CONSTRAINT fk_dhcp6_subnet_server_server_id FOREIGN KEY (server_id) REFERENCES dhcp6_server (id), + CONSTRAINT fk_dhcp6_subnet_server_subnet_id FOREIGN KEY (subnet_id) REFERENCES dhcp6_subnet (subnet_id), + UNIQUE (subnet_id, server_id) +); + +CREATE INDEX fk_dhcp6_subnet_server_server_id on dhcp6_subnet_server(server_id); +CREATE INDEX key_dhcp6_subnet_server_modification_ts on dhcp6_subnet_server(modification_ts); +CREATE TRIGGER dhcp6_subnet_server_modification_ts_update + AFTER UPDATE ON dhcp6_subnet_server + FOR EACH ROW EXECUTE PROCEDURE modification_ts_update(); + + -- Update the schema version number UPDATE schema_version SET version = '7', minor = '0';