renamed created_exists to created_column_not_exists in sql migration script

This commit is contained in:
mprokopchuk 2024-09-06 01:25:04 -07:00
parent a15fe4f1f4
commit cf8dd76d4c
1 changed files with 4 additions and 4 deletions

View File

@ -23,17 +23,17 @@
-- adding one more time here in case if migration from 4.18.0 didn't go through
CREATE PROCEDURE `cloud`.`ADD_RESOURCE_RESERVATION_MGMT_SERVER_ID_CREATED`()
BEGIN
DECLARE created_exists TINYINT DEFAULT FALSE
DECLARE created_column_not_exists TINYINT DEFAULT FALSE
; IF NOT EXISTS (SELECT * FROM `information_schema`.`columns` WHERE `table_schema` = 'cloud' AND `table_name` = 'resource_reservation' AND `column_name` = 'mgmt_server_id') THEN
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.resource_reservation', 'mgmt_server_id', 'bigint unsigned NULL COMMENT "management server id" ')
; END IF
; IF NOT EXISTS (SELECT * FROM `information_schema`.`columns` WHERE `table_schema` = 'cloud' AND `table_name` = 'resource_reservation' AND `column_name` = 'created') THEN
SET created_exists = TRUE
SET created_column_not_exists = TRUE
; END IF
; IF created_exists THEN
; IF created_column_not_exists THEN
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.resource_reservation', 'created', 'datetime DEFAULT NULL COMMENT "date when the reservation was created" ')
; END IF
; IF created_exists THEN
; IF created_column_not_exists THEN
UPDATE `cloud`.`resource_reservation` SET `created` = now() WHERE `created` IS NULL
; END IF
; END;