summaryrefslogtreecommitdiff
path: root/src/share/database/scripts/pgsql/dhcpdb_create.pgsql
diff options
context:
space:
mode:
authorThomas Markwalder <tmark@isc.org>2021-12-21 15:56:25 -0500
committerThomas Markwalder <tmark@isc.org>2022-01-07 15:26:56 -0500
commitfbed254406f387393c0a8065fc56665d31fad7f7 (patch)
treeca998bd24c1f955fad2c93083383f6673ea61679 /src/share/database/scripts/pgsql/dhcpdb_create.pgsql
parentffe4db49f115d346aa4629c2b8fce75f33b59ab4 (diff)
[#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
Diffstat (limited to 'src/share/database/scripts/pgsql/dhcpdb_create.pgsql')
-rw-r--r--src/share/database/scripts/pgsql/dhcpdb_create.pgsql42
1 files changed, 42 insertions, 0 deletions
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;