summaryrefslogtreecommitdiffstats
path: root/src/share/database/scripts
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2023-07-06 00:28:41 +0200
committerFrancis Dupont <fdupont@isc.org>2023-07-06 22:17:20 +0200
commit70c3890e5436e928a307376ab30d0926e1e5176d (patch)
tree864e0d9a50ed32ed50f6d463f9e0127b1a0698ab /src/share/database/scripts
parent[#2869] Finished test factoring (diff)
downloadkea-70c3890e5436e928a307376ab30d0926e1e5176d.tar.xz
kea-70c3890e5436e928a307376ab30d0926e1e5176d.zip
[#2869] Moved to inet in PostgreSQL
Diffstat (limited to 'src/share/database/scripts')
-rw-r--r--src/share/database/scripts/pgsql/dhcpdb_create.pgsql12
-rw-r--r--src/share/database/scripts/pgsql/upgrade_018_to_019.sh.in15
2 files changed, 27 insertions, 0 deletions
diff --git a/src/share/database/scripts/pgsql/dhcpdb_create.pgsql b/src/share/database/scripts/pgsql/dhcpdb_create.pgsql
index c5f488329b..8438937412 100644
--- a/src/share/database/scripts/pgsql/dhcpdb_create.pgsql
+++ b/src/share/database/scripts/pgsql/dhcpdb_create.pgsql
@@ -6284,6 +6284,18 @@ UPDATE dhcp6_global_parameter
SET name = 'ddns-conflict-resolution-mode', value = 'no-check-with-dhcid', parameter_type = 4
WHERE name = 'ddns-use-conflict-resolution' and value = 'false';
+-- Clear lease6_relay_id table.
+DELETE FROM lease6_relay_id;
+
+-- Change lease6_relay_id:lease_addr to INET.
+ALTER TABLE lease6_relay_id ALTER COLUMN lease_addr TYPE INET USING '::';
+
+-- Clear lease6_remote_id table.
+DELETE FROM lease6_remote_id;
+
+-- Change lease6_remote_id:lease_addr to INET.
+ALTER TABLE lease6_remote_id ALTER COLUMN lease_addr TYPE INET USING '::';
+
-- Update the schema version number.
UPDATE schema_version
SET version = '19', minor = '0';
diff --git a/src/share/database/scripts/pgsql/upgrade_018_to_019.sh.in b/src/share/database/scripts/pgsql/upgrade_018_to_019.sh.in
index 088fcd2cf6..8f5ded834a 100644
--- a/src/share/database/scripts/pgsql/upgrade_018_to_019.sh.in
+++ b/src/share/database/scripts/pgsql/upgrade_018_to_019.sh.in
@@ -34,6 +34,7 @@ if [ "$VERSION" != "18.0" ]; then
fi
psql "$@" >/dev/null <<EOF
+START TRANSACTION;
-- This line starts the schema upgrade to version 19.0.
@@ -55,6 +56,20 @@ UPDATE dhcp6_global_parameter
SET name = 'ddns-conflict-resolution-mode', value = 'no-check-with-dhcid', parameter_type = 4
WHERE name = 'ddns-use-conflict-resolution' and value = 'false';
+-- This line starts the schema upgrade to version 19.0.
+
+-- Clear lease6_relay_id table.
+DELETE FROM lease6_relay_id;
+
+-- Change lease6_relay_id:lease_addr to INET.
+ALTER TABLE lease6_relay_id ALTER COLUMN lease_addr TYPE INET USING '::';
+
+-- Clear lease6_remote_id table.
+DELETE FROM lease6_remote_id;
+
+-- Change lease6_remote_id:lease_addr to INET.
+ALTER TABLE lease6_remote_id ALTER COLUMN lease_addr TYPE INET USING '::';
+
-- Update the schema version number.
UPDATE schema_version
SET version = '19', minor = '0';