Commit facdfab1 authored by Toon Claes's avatar Toon Claes

Merge branch 'ci-platform-metrics-followup' into 'master'

Ensure migration is idempotent

See merge request gitlab-org/gitlab!40645
parents bff3d230 1382739d
......@@ -4,6 +4,7 @@ class CreateCiPlatformMetrics < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
CI_VARIABLES_KEY_INDEX_NAME = "index_ci_variables_on_key"
disable_ddl_transaction!
......@@ -17,11 +18,14 @@ class CreateCiPlatformMetrics < ActiveRecord::Migration[6.0]
end
add_text_limit :ci_platform_metrics, :platform_target, 255
add_concurrent_index :ci_variables, :key
add_concurrent_index :ci_variables, :key, name: CI_VARIABLES_KEY_INDEX_NAME
end
def down
drop_table :ci_platform_metrics
remove_concurrent_index :ci_variables, :key, name: 'index_ci_variables_on_key'
if table_exists?(:ci_platform_metrics)
drop_table :ci_platform_metrics
end
remove_concurrent_index :ci_variables, :key, name: CI_VARIABLES_KEY_INDEX_NAME
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment