From fe32a207e3fd163ffb5dfc99d6b5cbeb0be4f89d Mon Sep 17 00:00:00 2001 From: Blaize Kaye Date: Wed, 16 Mar 2022 15:06:52 +1300 Subject: [PATCH] Fixes error with argument names in advanced tasks --- .../docker-entrypoint-initdb.d/01-migrations.sql | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/services/api-db/docker-entrypoint-initdb.d/01-migrations.sql b/services/api-db/docker-entrypoint-initdb.d/01-migrations.sql index 5f466850ff..d4ea35a787 100644 --- a/services/api-db/docker-entrypoint-initdb.d/01-migrations.sql +++ b/services/api-db/docker-entrypoint-initdb.d/01-migrations.sql @@ -1354,6 +1354,20 @@ CREATE OR REPLACE PROCEDURE END; $$ +CREATE OR REPLACE PROCEDURE + change_name_index_for_advanced_task_argument() + BEGIN + IF EXISTS( + SELECT null FROM INFORMATION_SCHEMA.STATISTICS WHERE + TABLE_NAME = 'advanced_task_definition_argument' and INDEX_NAME = 'name' + ) THEN + ALTER TABLE `advanced_task_definition_argument` + DROP INDEX `name`; + ALTER TABLE `advanced_task_definition_argument` ADD CONSTRAINT advanced_task_definition_argument_unique UNIQUE(advanced_task_definition, name); + END IF; + END; +$$ + CREATE OR REPLACE PROCEDURE add_openshift_to_environment() @@ -1642,6 +1656,7 @@ CALL add_development_build_priority_to_project(); CALL add_priority_to_deployment(); CALL add_bulk_id_to_deployment(); CALL drop_legacy_permissions(); +CALL change_name_index_for_advanced_task_argument(); -- Drop legacy SSH key procedures DROP PROCEDURE IF EXISTS CreateProjectSshKey;