2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-10-07 13:36:21 +00:00

[#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
This commit is contained in:
Thomas Markwalder
2021-12-21 15:56:25 -05:00
parent ffe4db49f1
commit fbed254406
5 changed files with 75 additions and 11 deletions

View File

@@ -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;