From fbed254406f387393c0a8065fc56665d31fad7f7 Mon Sep 17 00:00:00 2001 From: Thomas Markwalder Date: Tue, 21 Dec 2021 15:56:25 -0500 Subject: [#2244] Added missing columns to PostgreSQL schema configure.ac added src/share/database/scripts/pgsql/upgrade_7.0_to_8.0.sh src/bin/admin/tests/pgsql_tests.sh.in Updated to test upgrading to 8.0 pgsql_upgrade_7_0_to_8_0() - new function src/lib/pgsql/pgsql_connection.h Updated schema version src/share/database/scripts/pgsql/Makefile.am added upgrade_7.0_to_8.0.sh.in src/share/database/scripts/pgsql/dhcpdb_create.pgsql Adds class_id column and constraints to dhcp4/6_option_def tables Adds preferred lifetime columns to dhcp6_client_class src/share/database/scripts/pgsql/upgrade_7.0_to_8.0.sh.in - new file Adds class_id column and constraints to dhcp4/6_option_def tables Adds preferred lifetime columns to dhcp6_client_class --- .../database/scripts/pgsql/dhcpdb_create.pgsql | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src/share/database/scripts/pgsql/dhcpdb_create.pgsql') diff --git a/src/share/database/scripts/pgsql/dhcpdb_create.pgsql b/src/share/database/scripts/pgsql/dhcpdb_create.pgsql index d8f6d3a830..ad417486d7 100644 --- a/src/share/database/scripts/pgsql/dhcpdb_create.pgsql +++ b/src/share/database/scripts/pgsql/dhcpdb_create.pgsql @@ -3795,6 +3795,48 @@ UPDATE schema_version -- Schema 7.0 specification ends here. +-- ----------------------------------------------------------------------- +-- Extend the table holding DHCPv4 option definitions with a nullable +-- column matching option defintions with client classes. +-- ----------------------------------------------------------------------- +ALTER TABLE dhcp4_option_def + ADD COLUMN class_id BIGINT NULL DEFAULT NULL; + +ALTER TABLE dhcp4_option_def + ADD CONSTRAINT fk_dhcp4_option_def_client_class_id + FOREIGN KEY (class_id) + REFERENCES dhcp4_client_class (id) + ON DELETE CASCADE + ON UPDATE CASCADE; + +-- ----------------------------------------------------------------------- +-- Extend the table holding DHCPv6 option definitions with a nullable +-- column matching option defintions with client classes. +-- ----------------------------------------------------------------------- +ALTER TABLE dhcp6_option_def + ADD COLUMN class_id BIGINT NULL DEFAULT NULL; + +ALTER TABLE dhcp6_option_def + ADD CONSTRAINT fk_dhcp6_option_def_client_class_id + FOREIGN KEY (class_id) + REFERENCES dhcp6_client_class (id) + ON DELETE CASCADE + ON UPDATE CASCADE; + +-- ----------------------------------------------------------------------- +-- Add missing preferred_lifetime columns to dhcp6_client_class table. +-- ----------------------------------------------------------------------- +ALTER TABLE dhcp6_client_class + ADD COLUMN preferred_lifetime BIGINT DEFAULT NULL, + ADD COLUMN min_preferred_lifetime BIGINT DEFAULT NULL, + ADD COLUMN max_preferred_lifetime BIGINT DEFAULT NULL; + +-- Update the schema version number +UPDATE schema_version + SET version = '8', minor = '0'; + +-- Schema 8.0 specification ends here. + -- Commit the script transaction COMMIT; -- cgit v1.2.3