test_finish 0
}
+# Verifies that OPT_RECORD_TYPE values are updated
+mysql_migrate_opt_record_type() {
+ test_start "mysql.migrate_opt_record_type"
+
+ # Let's wipe the whole database
+ mysql_wipe
+
+ # We need to create an older database with lease data so we can
+ # verify the upgrade mechanisms which prepopulate the lease stat
+ # tables.
+ #
+ # Initialize database to schema 1.0.
+ mysql_execute_script "@abs_top_srcdir@/src/bin/admin/tests/dhcpdb_create_1.0.mysql"
+ assert_eq 0 "${EXIT_CODE}" "cannot initialize 1.0 database, expected exit code: %d, actual: %d"
+
+ # Now upgrade to schema 23.0
+ mysql_upgrade_schema_to_version 23.0
+
+ # Now insert option definitions.
+ sql=\
+"set @disable_audit = 1; \
+ insert into dhcp4_option_def (code,name,space,type,modification_ts,record_types, is_array, encapsulate)\
+ values ('222','foo','dhcp4',17,current_timestamp,NULL, false, false);\
+ insert into dhcp4_option_def (code,name,space,type,modification_ts,record_types, is_array, encapsulate)\
+ values ('223','bar','dhcp4',17,current_timestamp,'10, 7, 2, 14', false, false);\
+ insert into dhcp4_option_def (code,name,space,type,modification_ts,record_types, is_array, encapsulate)\
+ values ('224','bar2','dhcp4',18,current_timestamp,'10, 7, 2, 14', false, false);
+ insert into dhcp6_option_def (code,name,space,type,modification_ts,record_types, is_array, encapsulate)\
+ values ('222','foo','dhcp6',17,current_timestamp,NULL, false, false);\
+ insert into dhcp6_option_def (code,name,space,type,modification_ts,record_types, is_array, encapsulate)\
+ values ('223','bar','dhcp6',17,current_timestamp,'10, 7, 2, 14', false, false);\
+ insert into dhcp6_option_def (code,name,space,type,modification_ts,record_types, is_array, encapsulate)\
+ values ('224','bar2','dhcp6',18,current_timestamp,'10, 7, 2, 14', false, false);
+"
+ run_statement "insert otion definitions" "$sql"
+
+ # Verify the inserted record counts.
+ qry="select count(*) from dhcp4_option_def;"
+ run_statement "#get 4_option_def_count before update" "$qry" 3
+
+ qry="select count(*) from dhcp6_option_def;"
+ run_statement "#get 6_option_def_count before update" "$qry" 3
+
+ # Upgrade to schema 24.0
+ mysql_upgrade_schema_to_version 24.0
+
+ # Verify the migrated records.
+ qry="select type from dhcp4_option_def where name = 'foo';"
+ run_statement "#get 4_option_def_foo after update" "$qry" 17
+
+ qry="select type from dhcp4_option_def where name = 'bar';"
+ run_statement "#get 4_option_def_bar after update" "$qry" 254
+
+ qry="select type from dhcp4_option_def where name = 'bar2';"
+ run_statement "#get 4_option_def_bar2 after update" "$qry" 254
+
+ qry="select type from dhcp6_option_def where name = 'foo';"
+ run_statement "#get 6_option_def_foo after update" "$qry" 17
+
+ qry="select type from dhcp6_option_def where name = 'bar';"
+ run_statement "#get 6_option_def_bar after update" "$qry" 254
+
+ qry="select type from dhcp6_option_def where name = 'bar2';"
+ run_statement "#get 6_option_def_bar2 after update" "$qry" 254
+
+ # Let's wipe the whole database
+ mysql_wipe
+
+ test_finish 0
+}
+
# Run tests.
mysql_db_init_test
mysql_host_reservation_init_test
mysql_reservation_mode_all_parameters_test
mysql_reservation_mode_global_parameters_test
mysql_reservation_mode_out_of_pool_parameters_test
+mysql_migrate_opt_record_type
test_finish 0
}
+# Verifies that OPT_RECORD_TYPE values are updated
+pgsql_migrate_opt_record_type() {
+ test_start "pgsql.migrate_opt_record_type"
+
+ # Let's wipe the whole database
+ pgsql_wipe
+
+ # We need to create an older database with lease data so we can
+ # verify the upgrade mechanisms which prepopulate the lease stat
+ # tables.
+ #
+ # Initialize database to schema 1.0.
+ pgsql_execute_script "@abs_top_srcdir@/src/bin/admin/tests/dhcpdb_create_1.0.pgsql"
+ assert_eq 0 "${EXIT_CODE}" "cannot initialize 1.0 database, expected exit code: %d, actual: %d"
+
+ # Now upgrade to schema 23.0
+ pgsql_upgrade_schema_to_version 23.0
+
+ # Now insert option definitions.
+ sql=\
+"select set_config('kea.disable_audit', 'true', false);\
+ insert into dhcp4_option_def (code,name,space,type,modification_ts,record_types, is_array, encapsulate)\
+ values ('222','foo','dhcp4',17,current_timestamp,NULL, false, false);\
+ insert into dhcp4_option_def (code,name,space,type,modification_ts,record_types, is_array, encapsulate)\
+ values ('223','bar','dhcp4',17,current_timestamp,'10, 7, 2, 14', false, false);\
+ insert into dhcp4_option_def (code,name,space,type,modification_ts,record_types, is_array, encapsulate)\
+ values ('224','bar2','dhcp4',18,current_timestamp,'10, 7, 2, 14', false, false);
+ insert into dhcp6_option_def (code,name,space,type,modification_ts,record_types, is_array, encapsulate)\
+ values ('222','foo','dhcp6',17,current_timestamp,NULL, false, false);\
+ insert into dhcp6_option_def (code,name,space,type,modification_ts,record_types, is_array, encapsulate)\
+ values ('223','bar','dhcp6',17,current_timestamp,'10, 7, 2, 14', false, false);\
+ insert into dhcp6_option_def (code,name,space,type,modification_ts,record_types, is_array, encapsulate)\
+ values ('224','bar2','dhcp6',18,current_timestamp,'10, 7, 2, 14', false, false);
+"
+ run_statement "insert otion definitions" "$sql"
+
+ # Verify the inserted record counts.
+ qry="select count(*) from dhcp4_option_def;"
+ run_statement "#get 4_option_def_count before update" "$qry" 3
+
+ qry="select count(*) from dhcp6_option_def;"
+ run_statement "#get 6_option_def_count before update" "$qry" 3
+
+ # Upgrade to schema 24.0
+ pgsql_upgrade_schema_to_version 24.0
+
+ # Verify the migrated records.
+ qry="select type from dhcp4_option_def where name = 'foo';"
+ run_statement "#get 4_option_def_foo after update" "$qry" 17
+
+ qry="select type from dhcp4_option_def where name = 'bar';"
+ run_statement "#get 4_option_def_bar after update" "$qry" 254
+
+ qry="select type from dhcp4_option_def where name = 'bar2';"
+ run_statement "#get 4_option_def_bar2 after update" "$qry" 254
+
+ qry="select type from dhcp6_option_def where name = 'foo';"
+ run_statement "#get 6_option_def_foo after update" "$qry" 17
+
+ qry="select type from dhcp6_option_def where name = 'bar';"
+ run_statement "#get 6_option_def_bar after update" "$qry" 254
+
+ qry="select type from dhcp6_option_def where name = 'bar2';"
+ run_statement "#get 6_option_def_bar2 after update" "$qry" 254
+
+ # Let's wipe the whole database
+ pgsql_wipe
+
+ test_finish 0
+}
+
# Run tests.
pgsql_db_init_test
pgsql_db_version_test
pgsql_reservation_mode_all_parameters_test
pgsql_reservation_mode_global_parameters_test
pgsql_reservation_mode_out_of_pool_parameters_test
+pgsql_migrate_opt_record_type
optionDefs4WithServerTagsTest();
}
+TEST_F(MySqlConfigBackendDHCPv4Test, invalidOptionDefDataType4Test) {
+ invalidOptionDefDataType4Test();
+}
+
+TEST_F(MySqlConfigBackendDHCPv4Test, allOptionDefDataTypes4Test) {
+ allOptionDefDataTypes4Test();
+}
+
TEST_F(MySqlConfigBackendDHCPv4Test, getAllOptionDefs4Test) {
getAllOptionDefs4Test();
}
optionDefs6WithServerTagsTest();
}
+TEST_F(MySqlConfigBackendDHCPv6Test, invalidOptionDefDataType6Test) {
+ invalidOptionDefDataType6Test();
+}
+
+TEST_F(MySqlConfigBackendDHCPv6Test, allOptionDefDataTypes6Test) {
+ allOptionDefDataTypes6Test();
+}
+
TEST_F(MySqlConfigBackendDHCPv6Test, getAllOptionDefs6Test) {
getAllOptionDefs6Test();
}
globalParameters4WithServerTagsTest();
}
+TEST_F(PgSqlConfigBackendDHCPv4Test, invalidOptionDefDataType4Test) {
+ invalidOptionDefDataType4Test();
+}
+
+TEST_F(PgSqlConfigBackendDHCPv4Test, allOptionDefDataTypes4Test) {
+ allOptionDefDataTypes4Test();
+}
+
TEST_F(PgSqlConfigBackendDHCPv4Test, getAllGlobalParameters4Test) {
getAllGlobalParameters4Test();
}
optionDefs6WithServerTagsTest();
}
+TEST_F(PgSqlConfigBackendDHCPv6Test, invalidOptionDefDataType6Test) {
+ invalidOptionDefDataType6Test();
+}
+
+TEST_F(PgSqlConfigBackendDHCPv6Test, allOptionDefDataTypes4Test) {
+ allOptionDefDataTypes6Test();
+}
+
TEST_F(PgSqlConfigBackendDHCPv6Test, getAllOptionDefs6Test) {
getAllOptionDefs6Test();
}
#include <dhcpsrv/cfgmgr.h>
#include <dhcpsrv/client_class_def.h>
#include <dhcpsrv/config_backend_dhcp4_mgr.h>
+#include <dhcpsrv/parsers/dhcp_parsers.h>
#include <dhcpsrv/pool.h>
#include <dhcpsrv/subnet.h>
#include <dhcpsrv/testutils/generic_cb_dhcp4_unittest.h>
test_option_defs_.push_back(option_def);
option_def.reset(new OptionDefinition("foobar", 234, DHCP4_OPTION_SPACE,
- "uint64", true));
+ "uint16", true));
test_option_defs_.push_back(option_def);
}
}
}
+void
+GenericConfigBackendDHCPv4Test::invalidOptionDefDataType4Test() {
+ OptionDefinitionPtr test_def;
+ ASSERT_NO_THROW_LOG(test_def.reset(new OptionDefinition("foobar", 234, DHCP4_OPTION_SPACE,
+ "unknown", true)));
+ ASSERT_TRUE(test_def);
+ ASSERT_THROW(cbptr_->createUpdateOptionDef4(ServerSelector::ALL(), test_def),
+ DbOperationError);
+}
+
+void
+GenericConfigBackendDHCPv4Test::allOptionDefDataTypes4Test() {
+
+ OptionDefListParser parser(AF_INET);
+ std::string defs_str = R"([
+ {
+ "name": "my-empty", "code": 221, "type": "empty", "array": false,
+ "record-types": "", "space": "dhcp4", "encapsulate": ""
+ },
+ {
+ "name": "my-binary", "code": 222, "type": "binary", "array": false,
+ "record-types": "", "space": "dhcp4", "encapsulate": ""
+ },
+ {
+ "name": "my-boolean", "code": 223, "type": "boolean", "array": false,
+ "record-types": "", "space": "dhcp4", "encapsulate": ""
+ },
+ {
+ "name": "my-int8", "code": 224, "type": "int8", "array": false,
+ "record-types": "", "space": "dhcp4", "encapsulate": ""
+ },
+ {
+ "name": "my-int16", "code": 225, "type": "int16", "array": false,
+ "record-types": "", "space": "dhcp4", "encapsulate": ""
+ },
+ {
+ "name": "my-int32", "code": 226, "type": "int32", "array": false,
+ "record-types": "", "space": "dhcp4", "encapsulate": ""
+ },
+ {
+ "name": "my-uint8", "code": 227, "type": "uint8", "array": false,
+ "record-types": "", "space": "dhcp4", "encapsulate": ""
+ },
+ {
+ "name": "my-uint16", "code": 228, "type": "uint16", "array": false,
+ "record-types": "", "space": "dhcp4", "encapsulate": ""
+ },
+ {
+ "name": "my-uint32", "code": 229, "type": "uint32", "array": false,
+ "record-types": "", "space": "dhcp4", "encapsulate": ""
+ },
+ {
+ "name": "my-ipv4-address", "code": 230, "type": "ipv4-address", "array": false,
+ "record-types": "", "space": "dhcp4", "encapsulate": ""
+ },
+ {
+ "name": "my-ipv6-address", "code": 231, "type": "ipv6-address", "array": false,
+ "record-types": "", "space": "dhcp4", "encapsulate": ""
+ },
+ {
+ "name": "my-ipv6-prefix", "code": 232, "type": "ipv6-prefix", "array": false,
+ "record-types": "", "space": "dhcp4", "encapsulate": ""
+ },
+ {
+ "name": "my-psid", "code": 233, "type": "psid", "array": false,
+ "record-types": "", "space": "dhcp4", "encapsulate": ""
+ },
+ {
+ "name": "my-string", "code": 234, "type": "string", "array": false,
+ "record-types": "", "space": "dhcp4", "encapsulate": ""
+ },
+ {
+ "name": "my-tuple", "code": 235, "type": "tuple", "array": false,
+ "record-types": "", "space": "dhcp4", "encapsulate": ""
+ },
+ {
+ "name": "my-fqdn", "code": 236, "type": "fqdn", "array": false,
+ "record-types": "", "space": "dhcp4", "encapsulate": ""
+ },
+ {
+ "name": "my-internal", "code": 237, "type": "internal", "array": false,
+ "record-types": "", "space": "dhcp4", "encapsulate": ""
+ },
+ {
+ "name": "my-record", "code": 238, "type": "record", "array": false,
+ "record-types": "uint8, uint8", "space": "dhcp4", "encapsulate": ""
+ }
+ ])";
+
+ ConstElementPtr defs_elem;
+ ASSERT_NO_THROW_LOG(defs_elem = Element::fromJSON(defs_str));
+
+ CfgOptionDefPtr storage(new CfgOptionDef());
+ ASSERT_NO_THROW_LOG(parser.parse(storage, defs_elem));
+
+ auto test_defs = storage->getAll("dhcp4");
+ ASSERT_EQ(test_defs->size(), 18);
+
+ // Insert each option definition into the database.
+ for (auto const& test_def : *test_defs) {
+ ASSERT_NO_THROW_LOG(cbptr_->createUpdateOptionDef4(ServerSelector::ALL(), test_def));
+ auto found_def = cbptr_->getOptionDef4(ServerSelector::ALL(),
+ test_def->getCode(), "dhcp4");
+
+ ASSERT_TRUE(found_def) << "no option found for " << test_def->getName();
+ ASSERT_EQ(*found_def, *test_def);
+ std::cout << "option ok for " << found_def->getName() << std::endl;
+ }
+}
+
void
GenericConfigBackendDHCPv4Test::getAllOptionDefs4Test() {
// Insert test option definitions into the database. Note that the second
-// Copyright (C) 2022 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2022-2024 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
/// all servers.
void optionDefs4WithServerTagsTest();
+ /// @brief This test verifies that the back end prevents storage
+ /// of definitions with invalid data types
+ void invalidOptionDefDataType4Test();
+
+ /// @brief This test verifies that it is possible to create options of each
+ /// valid data type.
+ void allOptionDefDataTypes4Test();
+
/// @brief Test that all option definitions can be fetched.
void getAllOptionDefs4Test();
#include <dhcpsrv/cfgmgr.h>
#include <dhcpsrv/client_class_def.h>
#include <dhcpsrv/config_backend_dhcp6_mgr.h>
+#include <dhcpsrv/parsers/dhcp_parsers.h>
#include <dhcpsrv/pool.h>
#include <dhcpsrv/subnet.h>
#include <dhcpsrv/testutils/generic_cb_dhcp6_unittest.h>
test_option_defs_.push_back(option_def);
option_def.reset(new OptionDefinition("bar", 1234, DHCP6_OPTION_SPACE,
- "uint64", true));
+ "uint16", true));
test_option_defs_.push_back(option_def);
}
}
}
+void
+GenericConfigBackendDHCPv6Test::invalidOptionDefDataType6Test() {
+ OptionDefinitionPtr test_def;
+ ASSERT_NO_THROW_LOG(test_def.reset(new OptionDefinition("foobar", 234, DHCP6_OPTION_SPACE,
+ "unknown", true)));
+ ASSERT_TRUE(test_def);
+ ASSERT_THROW(cbptr_->createUpdateOptionDef6(ServerSelector::ALL(), test_def),
+ DbOperationError);
+}
+
+void
+GenericConfigBackendDHCPv6Test::allOptionDefDataTypes6Test() {
+
+ OptionDefListParser parser(AF_INET);
+ std::string defs_str = R"([
+ {
+ "name": "my-empty", "code": 221, "type": "empty", "array": false,
+ "record-types": "", "space": "dhcp6", "encapsulate": ""
+ },
+ {
+ "name": "my-binary", "code": 222, "type": "binary", "array": false,
+ "record-types": "", "space": "dhcp6", "encapsulate": ""
+ },
+ {
+ "name": "my-boolean", "code": 223, "type": "boolean", "array": false,
+ "record-types": "", "space": "dhcp6", "encapsulate": ""
+ },
+ {
+ "name": "my-int8", "code": 224, "type": "int8", "array": false,
+ "record-types": "", "space": "dhcp6", "encapsulate": ""
+ },
+ {
+ "name": "my-int16", "code": 225, "type": "int16", "array": false,
+ "record-types": "", "space": "dhcp6", "encapsulate": ""
+ },
+ {
+ "name": "my-int32", "code": 226, "type": "int32", "array": false,
+ "record-types": "", "space": "dhcp6", "encapsulate": ""
+ },
+ {
+ "name": "my-uint8", "code": 227, "type": "uint8", "array": false,
+ "record-types": "", "space": "dhcp6", "encapsulate": ""
+ },
+ {
+ "name": "my-uint16", "code": 228, "type": "uint16", "array": false,
+ "record-types": "", "space": "dhcp6", "encapsulate": ""
+ },
+ {
+ "name": "my-uint32", "code": 229, "type": "uint32", "array": false,
+ "record-types": "", "space": "dhcp6", "encapsulate": ""
+ },
+ {
+ "name": "my-ipv4-address", "code": 230, "type": "ipv4-address", "array": false,
+ "record-types": "", "space": "dhcp6", "encapsulate": ""
+ },
+ {
+ "name": "my-ipv6-address", "code": 231, "type": "ipv6-address", "array": false,
+ "record-types": "", "space": "dhcp6", "encapsulate": ""
+ },
+ {
+ "name": "my-ipv6-prefix", "code": 232, "type": "ipv6-prefix", "array": false,
+ "record-types": "", "space": "dhcp6", "encapsulate": ""
+ },
+ {
+ "name": "my-psid", "code": 233, "type": "psid", "array": false,
+ "record-types": "", "space": "dhcp6", "encapsulate": ""
+ },
+ {
+ "name": "my-string", "code": 234, "type": "string", "array": false,
+ "record-types": "", "space": "dhcp6", "encapsulate": ""
+ },
+ {
+ "name": "my-tuple", "code": 235, "type": "tuple", "array": false,
+ "record-types": "", "space": "dhcp6", "encapsulate": ""
+ },
+ {
+ "name": "my-fqdn", "code": 236, "type": "fqdn", "array": false,
+ "record-types": "", "space": "dhcp6", "encapsulate": ""
+ },
+ {
+ "name": "my-internal", "code": 237, "type": "internal", "array": false,
+ "record-types": "", "space": "dhcp6", "encapsulate": ""
+ },
+ {
+ "name": "my-record", "code": 238, "type": "record", "array": false,
+ "record-types": "uint8, uint8", "space": "dhcp6", "encapsulate": ""
+ }
+ ])";
+
+ ConstElementPtr defs_elem;
+ ASSERT_NO_THROW_LOG(defs_elem = Element::fromJSON(defs_str));
+
+ CfgOptionDefPtr storage(new CfgOptionDef());
+ ASSERT_NO_THROW_LOG(parser.parse(storage, defs_elem));
+
+ auto test_defs = storage->getAll("dhcp6");
+ ASSERT_EQ(test_defs->size(), 18);
+
+ // Insert each option definition into the database.
+ for (auto const& test_def : *test_defs) {
+ ASSERT_NO_THROW_LOG(cbptr_->createUpdateOptionDef6(ServerSelector::ALL(), test_def));
+ auto found_def = cbptr_->getOptionDef6(ServerSelector::ALL(),
+ test_def->getCode(), "dhcp6");
+
+ ASSERT_TRUE(found_def) << "no option found for " << test_def->getName();
+ ASSERT_EQ(*found_def, *test_def);
+ std::cout << "option ok for " << found_def->getName() << std::endl;
+ }
+}
+
void
GenericConfigBackendDHCPv6Test::getAllOptionDefs6Test() {
// Insert test option definitions into the database. Note that the second
-// Copyright (C) 2022 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2022-2024 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
/// all servers.
void optionDefs6WithServerTagsTest();
+ /// @brief This test verifies that the back end prevents storage
+ /// of definitions with invalid data types
+ void invalidOptionDefDataType6Test();
+
+ /// @brief This test verifies that it is possible to create options of each
+ /// valid data type.
+ void allOptionDefDataTypes6Test();
+
/// @brief Test that all option definitions can be fetched.
void getAllOptionDefs6Test();
-- If they're coming from pre-2.6.0 record type is 17, from
-- 2.6.0 or 2.7.0 it is 18. No viable to way to know where we
-- started.
- UPDATE dhcp4_option_def SET type = 254 WHERE type >= 17 AND record_types IS NOT NULL;
- UPDATE dhcp6_option_def SET type = 254 WHERE type >= 17 AND record_types IS NOT NULL;
+ SET @disable_audit = 1;
+ UPDATE dhcp4_option_def SET type = 254 WHERE record_types IS NOT NULL;
+ UPDATE dhcp6_option_def SET type = 254 WHERE record_types IS NOT NULL;
-- Create the table that enumerates option definition data types.
CREATE TABLE option_def_data_type (
# Check version.
version=$(mysql_version "${@}")
-if test "${version}" != "22.0"; then
- printf 'This script upgrades 22.0 to 23.0. '
+if [ "$version" != "22.0" ] && [ "$version" != "22.1" ]; then
+ printf 'This script upgrades 22.0 or 22.1 to 23.0. '
printf 'Reported version is %s. Skipping upgrade.\n' "${version}"
exit 0
fi
-- If they're coming from pre-2.6.0 record type is 17, from
-- 2.6.0 or 2.7.0 it is 18. No viable to way to know where we
-- started.
- UPDATE dhcp4_option_def SET type = 254 WHERE type >= 17 AND record_types IS NOT NULL;
- UPDATE dhcp6_option_def SET type = 254 WHERE type >= 17 AND record_types IS NOT NULL;
+ SET @disable_audit = 1;
+ UPDATE dhcp4_option_def SET type = 254 WHERE record_types IS NOT NULL;
+ UPDATE dhcp6_option_def SET type = 254 WHERE record_types IS NOT NULL;
-- Create the table that enumerates option definition data types.
CREATE TABLE option_def_data_type (
RETURN 'EXISTS';
END IF;
- -- First we migrate existing OPT_RECORD_TYPE values
- -- If they're coming from pre-2.6.0 record type is 17, from
- -- 2.6.0 or 2.7.0 it is 18. No viable to way to know where we
- -- started.
-
- -- Can we attempt to discern between internal and rec by testing
- -- record_types?
- UPDATE dhcp4_option_def SET type = 254 WHERE type >= 17 AND record_types IS NOT NULL;
- UPDATE dhcp6_option_def SET type = 254 WHERE type >= 17 AND record_types IS NOT NULL;
+ -- First we migrate existing OPT_RECORD_TYPE values.
+ PERFORM set_config('kea.disable_audit', 'true', false);
+ UPDATE dhcp4_option_def SET type = 254 WHERE record_types IS NOT NULL;
+ UPDATE dhcp6_option_def SET type = 254 WHERE record_types IS NOT NULL;
-- Create the table that enumerates option definition data types.
CREATE TABLE option_def_data_type (
VERSION=$(pgsql_version "$@")
-if [ "$VERSION" != "22.0" ]; then
- printf 'This script upgrades 22.0 to 23.0. '
+if [ "$VERSION" != "22.0" ] && [ "$VERSION" != "22.1" ]; then
+ printf 'This script upgrades 22.0 or 22.1 to 23.0. '
printf 'Reported version is %s. Skipping upgrade.\n' "${VERSION}"
exit 0
fi
RETURN 'EXISTS';
END IF;
- -- First we migrate existing OPT_RECORD_TYPE values
- -- If they're coming from pre-2.6.0 record type is 17, from
- -- 2.6.0 or 2.7.0 it is 18. No viable to way to know where we
- -- started.
-
- -- Can we attempt to discern between internal and rec by testing
- -- record_types?
- UPDATE dhcp4_option_def SET type = 254 WHERE type >= 17 AND record_types IS NOT NULL;
- UPDATE dhcp6_option_def SET type = 254 WHERE type >= 17 AND record_types IS NOT NULL;
+ -- First we migrate existing OPT_RECORD_TYPE values.
+ PERFORM set_config('kea.disable_audit', 'true', false);
+ UPDATE dhcp4_option_def SET type = 254 WHERE record_types IS NOT NULL;
+ UPDATE dhcp6_option_def SET type = 254 WHERE record_types IS NOT NULL;
-- Create the table that enumerates option definition data types.
CREATE TABLE option_def_data_type (