]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1698] move cache columns to 9.6 mysql upgrade
authorAndrei Pavel <andrei@isc.org>
Fri, 19 Feb 2021 10:55:45 +0000 (12:55 +0200)
committerAndrei Pavel <andrei@isc.org>
Mon, 22 Feb 2021 15:58:31 +0000 (17:58 +0200)
src/bin/admin/tests/mysql_tests.sh.in
src/share/database/scripts/mysql/Makefile.am
src/share/database/scripts/mysql/dhcpdb_create.mysql
src/share/database/scripts/mysql/upgrade_9.4_to_9.5.sh.in
src/share/database/scripts/mysql/upgrade_9.5_to_9.6.sh.in

index 6592e5ae3b9d61719a18bfe4bfba1f9b32086b83..9e2c256d11bc05bc10fe663944cf90b5d8292a86 100644 (file)
@@ -809,6 +809,8 @@ insert into hosts(dhcp_identifier, dhcp_identifier_type, dhcp4_subnet_id, ipv4_a
     count=$(echo "${OUTPUT}" | grep -Fci reservation) || true
     assert_eq 0 "${count}" "dhcp6_subnet has still reservation_mode column. (returned count %d, expected %d)"
 
+    # Schema upgrade from 9.5 to 9.6.
+
     # table: dhcp4_shared_network new cache_threshold and cache_max_age columns
     qry="select cache_threshold, cache_max_age from dhcp4_shared_network"
     run_statement "dhcp4_shared_network" "$qry"
@@ -825,8 +827,6 @@ insert into hosts(dhcp_identifier, dhcp_identifier_type, dhcp4_subnet_id, ipv4_a
     qry="select cache_threshold, cache_max_age from dhcp6_subnet"
     run_statement "dhcp6_shared_network" "$qry"
 
-    # Schema upgrade from 9.5 to 9.6.
-
     qry='SELECT id FROM logs';
     run_command \
         mysql_execute "${qry}"
index cb496e435a91027b741a4e35477d313e9356336b..846f468202169ec870b4f93a3f04627d64011926 100644 (file)
@@ -27,6 +27,7 @@ mysql_SCRIPTS += upgrade_9.1_to_9.2.sh
 mysql_SCRIPTS += upgrade_9.2_to_9.3.sh
 mysql_SCRIPTS += upgrade_9.3_to_9.4.sh
 mysql_SCRIPTS += upgrade_9.4_to_9.5.sh
+mysql_SCRIPTS += upgrade_9.5_to_9.6.sh
 mysql_SCRIPTS += wipe_data.sh
 
 DISTCLEANFILES = ${mysql_SCRIPTS}
index 09ea22d2f20fa375039d8392a968591f61d725ff..06edf336a8c2d1ad13f29fe7308d688dc1044088 100644 (file)
@@ -3054,6 +3054,12 @@ ALTER TABLE dhcp4_shared_network DROP COLUMN reservation_mode;
 ALTER TABLE dhcp6_subnet DROP COLUMN reservation_mode;
 ALTER TABLE dhcp6_shared_network DROP COLUMN reservation_mode;
 
+# Update the schema version number
+UPDATE schema_version
+SET version = '9', minor = '5';
+
+# This line concludes database upgrade to version 9.5.
+
 # Add new lease cache parameters.
 ALTER TABLE dhcp4_subnet
     ADD COLUMN cache_threshold FLOAT DEFAULT NULL,
@@ -3071,11 +3077,11 @@ ALTER TABLE dhcp6_shared_network
     ADD COLUMN cache_threshold FLOAT DEFAULT NULL,
     ADD COLUMN cache_max_age INT(10) DEFAULT NULL;
 
-# Update the schema version number
+# Update the schema version number.
 UPDATE schema_version
-SET version = '9', minor = '5';
+    SET version = '9', minor = '6';
 
-# This line concludes database upgrade to version 9.5.
+# This line concludes database upgrade to version 9.6.
 
 # Add an auto-increment ID as primary key to support Percona.
 ALTER TABLE logs
index 576186243e2923796571d210abf3d888dc5d1057..ebf3117f8068236080f6a75484a417ce0894a86e 100644 (file)
@@ -161,23 +161,6 @@ ALTER TABLE dhcp6_shared_network DROP COLUMN reservation_mode;
 # Enable audit in this session
 SET @disable_audit = 0;
 
-# Add new lease cache parameters.
-ALTER TABLE dhcp4_subnet
-    ADD COLUMN cache_threshold FLOAT DEFAULT NULL,
-    ADD COLUMN cache_max_age INT(10) DEFAULT NULL;
-
-ALTER TABLE dhcp4_shared_network
-    ADD COLUMN cache_threshold FLOAT DEFAULT NULL,
-    ADD COLUMN cache_max_age INT(10) DEFAULT NULL;
-
-ALTER TABLE dhcp6_subnet
-    ADD COLUMN cache_threshold FLOAT DEFAULT NULL,
-    ADD COLUMN cache_max_age INT(10) DEFAULT NULL;
-
-ALTER TABLE dhcp6_shared_network
-    ADD COLUMN cache_threshold FLOAT DEFAULT NULL,
-    ADD COLUMN cache_max_age INT(10) DEFAULT NULL;
-
 # Update the schema version number
 UPDATE schema_version
 SET version = '9', minor = '5';
index 1ea51f62e7188de01d28588dce7938525ddc3631..1d9f99860fb0e68ced2aef3fa5ae523eb5a6c242 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright (C) 2020-2021 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC")
 #
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -34,6 +34,23 @@ if test "${version}" != "9.5"; then
 fi
 
 mysql "$@" <<EOF
+# Add new lease cache parameters.
+ALTER TABLE dhcp4_subnet
+    ADD COLUMN cache_threshold FLOAT DEFAULT NULL,
+    ADD COLUMN cache_max_age INT(10) DEFAULT NULL;
+
+ALTER TABLE dhcp4_shared_network
+    ADD COLUMN cache_threshold FLOAT DEFAULT NULL,
+    ADD COLUMN cache_max_age INT(10) DEFAULT NULL;
+
+ALTER TABLE dhcp6_subnet
+    ADD COLUMN cache_threshold FLOAT DEFAULT NULL,
+    ADD COLUMN cache_max_age INT(10) DEFAULT NULL;
+
+ALTER TABLE dhcp6_shared_network
+    ADD COLUMN cache_threshold FLOAT DEFAULT NULL,
+    ADD COLUMN cache_max_age INT(10) DEFAULT NULL;
+
 # Add an auto-increment ID as primary key to support Percona.
 ALTER TABLE logs
     ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY;