From 58625eeb85cfe77f908d30782fd8c61d9c6ac6ee Mon Sep 17 00:00:00 2001 From: Tomek Mrugalski Date: Tue, 8 Jun 2021 19:07:22 +0200 Subject: [PATCH] [#90] added dhcp4_options_server --- .../scripts/pgsql/upgrade_6.2_to_7.0.sh.in | 16 ++++++++++++++++ 1 file changed, 16 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 4589a2b464..d3fdead8af 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 @@ -615,6 +615,22 @@ CREATE TRIGGER dhcp4_option_def_server_modification_ts_update FOR EACH ROW EXECUTE PROCEDURE modification_ts_update(); +-- Now create a table for associating defined options with servers. +CREATE TABLE dhcp4_options_server ( + option_id BIGINT NOT NULL, + server_id BIGINT NOT NULL, + modification_ts timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (option_id, server_id), + CONSTRAINT fk_dhcp6_options_server_option_id FOREIGN KEY (option_id) REFERENCES dhcp4_options (option_id) ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT fk_dhcp6_options_server_server_id FOREIGN KEY (server_id) REFERENCES dhcp4_server (id) ON DELETE CASCADE ON UPDATE NO ACTION +); +CREATE INDEX dhcp4_options_server_idx1 on dhcp4_options_server(server_id); +CREATE INDEX dhcp4_options_server_idx2 on dhcp4_options_server(modification_ts); +CREATE TRIGGER dhcp4_options_server_modification_ts_update + AFTER UPDATE ON dhcp4_options_server + FOR EACH ROW EXECUTE PROCEDURE modification_ts_update(); + + -- Update the schema version number UPDATE schema_version SET version = '7', minor = '0';