diff options
Diffstat (limited to 'src/share/database/scripts')
-rw-r--r-- | src/share/database/scripts/mysql/dhcpdb_create.mysql | 34 | ||||
-rw-r--r-- | src/share/database/scripts/mysql/upgrade_026_to_027.sh.in | 34 |
2 files changed, 68 insertions, 0 deletions
diff --git a/src/share/database/scripts/mysql/dhcpdb_create.mysql b/src/share/database/scripts/mysql/dhcpdb_create.mysql index a212dc8cf9..8423b8e328 100644 --- a/src/share/database/scripts/mysql/dhcpdb_create.mysql +++ b/src/share/database/scripts/mysql/dhcpdb_create.mysql @@ -6070,27 +6070,61 @@ UPDATE schema_version -- This line starts the schema upgrade to version 27.0. +SET @disable_audit = 1; + +DROP FUNCTION IF EXISTS textToJSONList; +DELIMITER $$ +CREATE FUNCTION textToJSONList(orig TEXT) +RETURNS TEXT +DETERMINISTIC +BEGIN + IF orig = '' THEN + RETURN NULL; + END IF; + + RETURN CONCAT('[ "', orig, '" ]'); +END $$ +DELIMITER ; + ALTER TABLE dhcp4_shared_network CHANGE client_class client_classes LONGTEXT DEFAULT NULL; +UPDATE dhcp4_shared_network SET client_classes = textToJSONList(client_classes); + ALTER TABLE dhcp4_subnet CHANGE client_class client_classes LONGTEXT DEFAULT NULL; +UPDATE dhcp4_subnet SET client_classes = textToJSONList(client_classes); + ALTER TABLE dhcp4_pool CHANGE client_class client_classes LONGTEXT DEFAULT NULL; +UPDATE dhcp4_pool SET client_classes = textToJSONList(client_classes); + ALTER TABLE dhcp6_shared_network CHANGE client_class client_classes LONGTEXT DEFAULT NULL; +UPDATE dhcp6_shared_network SET client_classes = textToJSONList(client_classes); + ALTER TABLE dhcp6_subnet CHANGE client_class client_classes LONGTEXT DEFAULT NULL; +UPDATE dhcp6_subnet SET client_classes = textToJSONList(client_classes); + ALTER TABLE dhcp6_pool CHANGE client_class client_classes LONGTEXT DEFAULT NULL; +UPDATE dhcp6_pool SET client_classes = textToJSONList(client_classes); + ALTER TABLE dhcp6_pd_pool CHANGE client_class client_classes LONGTEXT DEFAULT NULL; +UPDATE dhcp6_pd_pool SET client_classes = textToJSONList(client_classes); + +DROP FUNCTION textToJSONList; + +SET @disable_audit = 0; + -- Update the schema version number. UPDATE schema_version SET version = '27', minor = '0'; diff --git a/src/share/database/scripts/mysql/upgrade_026_to_027.sh.in b/src/share/database/scripts/mysql/upgrade_026_to_027.sh.in index 552eb179ae..0178a2a149 100644 --- a/src/share/database/scripts/mysql/upgrade_026_to_027.sh.in +++ b/src/share/database/scripts/mysql/upgrade_026_to_027.sh.in @@ -56,27 +56,61 @@ mysql "$@" <<EOF -- This line starts the schema upgrade to version 27.0. +SET @disable_audit = 1; + +DROP FUNCTION IF EXISTS textToJSONList; +DELIMITER $$ +CREATE FUNCTION textToJSONList(orig TEXT) +RETURNS TEXT +DETERMINISTIC +BEGIN + IF orig = '' THEN + RETURN NULL; + END IF; + + RETURN CONCAT('[ "', orig, '" ]'); +END $$ +DELIMITER ; + ALTER TABLE dhcp4_shared_network CHANGE client_class client_classes LONGTEXT DEFAULT NULL; +UPDATE dhcp4_shared_network SET client_classes = textToJSONList(client_classes); + ALTER TABLE dhcp4_subnet CHANGE client_class client_classes LONGTEXT DEFAULT NULL; +UPDATE dhcp4_subnet SET client_classes = textToJSONList(client_classes); + ALTER TABLE dhcp4_pool CHANGE client_class client_classes LONGTEXT DEFAULT NULL; +UPDATE dhcp4_pool SET client_classes = textToJSONList(client_classes); + ALTER TABLE dhcp6_shared_network CHANGE client_class client_classes LONGTEXT DEFAULT NULL; +UPDATE dhcp6_shared_network SET client_classes = textToJSONList(client_classes); + ALTER TABLE dhcp6_subnet CHANGE client_class client_classes LONGTEXT DEFAULT NULL; +UPDATE dhcp6_subnet SET client_classes = textToJSONList(client_classes); + ALTER TABLE dhcp6_pool CHANGE client_class client_classes LONGTEXT DEFAULT NULL; +UPDATE dhcp6_pool SET client_classes = textToJSONList(client_classes); + ALTER TABLE dhcp6_pd_pool CHANGE client_class client_classes LONGTEXT DEFAULT NULL; +UPDATE dhcp6_pd_pool SET client_classes = textToJSONList(client_classes); + +DROP FUNCTION textToJSONList; + +SET @disable_audit = 0; + -- Update the schema version number. UPDATE schema_version SET version = '27', minor = '0'; |