BigW Consortium Gitlab

Commit 6ff162cf by Lin Jen-Shin

Add back project_id index for MySQL if reverting

parent d34e8781
......@@ -12,7 +12,12 @@ class AddUniqueConstraintToCiVariables < ActiveRecord::Migration
end
def down
if this_index_exists? && Gitlab::Database.postgresql?
if this_index_exists?
if Gitlab::Database.mysql? && !index_exists?(:ci_variables, :project_id)
# Need to add this index for MySQL project_id foreign key constraint
add_concurrent_index(:ci_variables, :project_id)
end
remove_concurrent_index(:ci_variables, columns, name: index_name)
end
end
......@@ -20,7 +25,7 @@ class AddUniqueConstraintToCiVariables < ActiveRecord::Migration
private
def this_index_exists?
index_exists?(:ci_variables, name: index_name)
index_exists?(:ci_variables, columns, name: index_name)
end
def columns
......
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