src/share/database/scripts/mysql/upgrade_4.0_to_4.1.sh
src/share/database/scripts/mysql/upgrade_4.1_to_5.0.sh
src/share/database/scripts/mysql/upgrade_5.0_to_5.1.sh
+ src/share/database/scripts/mysql/upgrade_5.1_to_5.2.sh
src/share/database/scripts/pgsql/Makefile
src/share/database/scripts/pgsql/upgrade_1.0_to_2.0.sh
src/share/database/scripts/pgsql/upgrade_2.0_to_3.0.sh
src/share/database/scripts/pgsql/upgrade_3.0_to_3.1.sh
src/share/database/scripts/pgsql/upgrade_3.1_to_3.2.sh
+ src/share/database/scripts/pgsql/upgrade_3.2_to_3.3.sh
tools/Makefile
tools/path_replacer.sh
])
count=`echo $text | grep -ic unsigned`
assert_eq 1 $count "dhcp6_subnet_id is not of unsigned type. (expected count %d, returned %d)"
- # Verify upgraded schema reports version 5.1
+ # Verify upgraded schema reports version 5.2
version=$(${keaadmin} lease-version mysql -u $db_user -p $db_password -n $db_name -d $db_scripts_dir)
- assert_str_eq "5.1" ${version} "Expected kea-admin to return %s, returned value was %s"
+ assert_str_eq "5.2" ${version} "Expected kea-admin to return %s, returned value was %s"
# Let's wipe the whole database
mysql_wipe
# Verify that kea-admin lease-version returns the correct version
version=$(${keaadmin} lease-version pgsql -u $db_user -p $db_password -n $db_name)
- assert_str_eq "3.2" ${version} "Expected kea-admin to return %s, returned value was %s"
+ assert_str_eq "3.3" ${version} "Expected kea-admin to return %s, returned value was %s"
# Let's wipe the whole database
pgsql_wipe
assert_eq 1 "$output" "lease_hwaddr_source does not contain entry for HWADDR_SOURCE_UNKNOWN. (record count %d, expected %d)"
}
-pgsql_upgrade_3_0_to_3_1() {
- # Verify upgraded schema reports version 3.1.
+pgsql_upgrade_3_0_to_3_3() {
+ # Verify upgraded schema reports version 3.3.
version=$(${keaadmin} lease-version pgsql -u $db_user -p $db_password -n $db_name -d $db_scripts_dir)
- assert_str_eq "3.1" ${version} "Expected kea-admin to return %s, returned value was %s"
+ assert_str_eq "3.3" ${version} "Expected kea-admin to return %s, returned value was %s"
}
pgsql_upgrade_test() {
# Check 2.0 to 3.0 upgrade
pgsql_upgrade_2_0_to_3_0
- # Check 3.0 to 3.1 upgrade
- pgsql_upgrade_3_0_to_3_1
+ # Check 3.0 to 3.3 upgrade
+ pgsql_upgrade_3_0_to_3_3
# Let's wipe the whole database
pgsql_wipe
/// @name Current database schema version values.
//@{
const uint32_t MYSQL_SCHEMA_VERSION_MAJOR = 5;
-const uint32_t MYSQL_SCHEMA_VERSION_MINOR = 1;
+const uint32_t MYSQL_SCHEMA_VERSION_MINOR = 2;
//@}
namespace isc {
namespace dhcp {
-/// @brief Define PostgreSQL backend version: 3.2
+/// @brief Define PostgreSQL backend version: 3.3
const uint32_t PG_SCHEMA_VERSION_MAJOR = 3;
-const uint32_t PG_SCHEMA_VERSION_MINOR = 2;
+const uint32_t PG_SCHEMA_VERSION_MINOR = 3;
// Maximum number of parameters that can be used a statement
// @todo This allows us to use an initializer list (since we can't
/upgrade_4.0_to_4.1.sh
/upgrade_4.1_to_5.0.sh
/upgrade_5.0_to_5.1.sh
+/upgrade_5.1_to_5.2.sh
+
SET version = '5', minor = '1';
# This line concludes database upgrade to version 5.1.
+# Make subnet_id column types consistent with lease table columns
+ALTER TABLE dhcp4_options MODIFY dhcp4_subnet_id INT UNSIGNED;
+ALTER TABLE dhcp6_options MODIFY dhcp6_subnet_id INT UNSIGNED;
+
+# Update the schema version number
+UPDATE schema_version
+SET version = '5', minor = '2';
+
+# This line concludes database upgrade to version 5.2.
+
# Notes:
#
# Indexes
--- /dev/null
+#!/bin/sh
+
+# Include utilities. Use installed version if available and
+# use build version if it isn't.
+if [ -e @datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh ]; then
+ . @datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh
+else
+ . @abs_top_builddir@/src/bin/admin/admin-utils.sh
+fi
+
+VERSION=`mysql_version "$@"`
+
+if [ "$VERSION" != "5.1" ]; then
+ printf "This script upgrades 5.1 to 5.2. Reported version is $VERSION. Skipping upgrade.\n"
+ exit 0
+fi
+
+mysql "$@" <<EOF
+
+# Make subnet_id column types consistent with lease table columns
+ALTER TABLE dhcp4_options MODIFY dhcp4_subnet_id INT UNSIGNED;
+ALTER TABLE dhcp6_options MODIFY dhcp6_subnet_id INT UNSIGNED;
+
+# Update the schema version number
+UPDATE schema_version
+SET version = '5', minor = '2';
+# This line concludes database upgrade to version 5.2.
+
+EOF
+
+RESULT=$?
+
+exit $?
upgrade_2.0_to_3.0.sh
upgrade_3.0_to_3.1.sh
upgrade_3.1_to_3.2.sh
+upgrade_3.2_to_3.3.sh
sqlscripts_DATA += upgrade_2.0_to_3.0.sh
sqlscripts_DATA += upgrade_3.0_to_3.1.sh
sqlscripts_DATA += upgrade_3.1_to_3.2.sh
+sqlscripts_DATA += upgrade_3.2_to_3.3.sh
DISTCLEANFILES = upgrade_1.0_to_2.0.sh
DISTCLEANFILES += upgrade_2.0_to_3.0.sh
DISTCLEANFILES += upgrade_3.0_to_3.1.sh
DISTCLEANFILES += upgrade_3.1_to_3.2.sh
+DISTCLEANFILES += upgrade_3.2_to_3.3.sh
EXTRA_DIST = ${sqlscripts_DATA}
UPDATE schema_version
SET version = '3', minor = '1';
--- Set 3.2 schema version.
+-- Schema 3.1 specification ends here.
-- Remove constraints which perform too restrictive checks on the inserted
-- host reservations. We want to be able to insert host reservations which
UPDATE schema_version
SET version = '3', minor = '2';
+-- Schema 3.2 specification ends here.
+
+-- Change subnet ID columns type to BIGINT to match lease4/6 tables
+ALTER TABLE hosts ALTER COLUMN dhcp4_subnet_id TYPE BIGINT;
+ALTER TABLE hosts ALTER COLUMN dhcp4_subnet_id TYPE BIGINT;
+
+ALTER TABLE dhcp4_options ALTER COLUMN dhcp4_subnet_id TYPE BIGINT;
+ALTER TABLE dhcp6_options ALTER COLUMN dhcp6_subnet_id TYPE BIGINT;
+
+-- Set 3.3 schema version.
+UPDATE schema_version
+ SET version = '3', minor = '3';
+
+-- Schema 3.3 specification ends here.
--- Commit the script transaction.
+-- Commit the script transaction
COMMIT;
-- Notes:
VERSION=`pgsql_version "$@"`
-if [ "$VERSION" != "3.0" ]; then
- printf "This script upgrades 3.0 to 3.1. Reported version is $VERSION. Skipping upgrade.\n"
+if [ "$VERSION" != "3.1" ]; then
+ printf "This script upgrades 3.1 to 3.2. Reported version is $VERSION. Skipping upgrade.\n"
exit 0
fi
--- /dev/null
+#!/bin/sh
+
+# Include utilities. Use installed version if available and
+# use build version if it isn't.
+if [ -e @datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh ]; then
+ . @datarootdir@/@PACKAGE_NAME@/scripts/admin-utils.sh
+else
+ . @abs_top_builddir@/src/bin/admin/admin-utils.sh
+fi
+
+VERSION=`pgsql_version "$@"`
+
+if [ "$VERSION" != "3.2" ]; then
+ printf "This script upgrades 3.2 to 3.3. Reported version is $VERSION. Skipping upgrade.\n"
+ exit 0
+fi
+
+psql "$@" >/dev/null <<EOF
+
+START TRANSACTION;
+
+-- Change subnet ID columns type to BIGINT to match lease4/6 tables
+ALTER TABLE hosts ALTER COLUMN dhcp4_subnet_id TYPE BIGINT;
+ALTER TABLE hosts ALTER COLUMN dhcp4_subnet_id TYPE BIGINT;
+
+ALTER TABLE dhcp4_options ALTER COLUMN dhcp4_subnet_id TYPE BIGINT;
+ALTER TABLE dhcp6_options ALTER COLUMN dhcp6_subnet_id TYPE BIGINT;
+
+-- Set 3.3 schema version.
+UPDATE schema_version
+ SET version = '3', minor = '3';
+
+-- Schema 3.3 specification ends here.
+
+-- Commit the script transaction
+COMMIT;
+
+EOF
+
+exit $RESULT