Commit 6ff162cf authored by Lin Jen-Shin's avatar Lin Jen-Shin

Add back project_id index for MySQL if reverting

parent d34e8781
...@@ -12,7 +12,12 @@ class AddUniqueConstraintToCiVariables < ActiveRecord::Migration ...@@ -12,7 +12,12 @@ class AddUniqueConstraintToCiVariables < ActiveRecord::Migration
end end
def down 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) remove_concurrent_index(:ci_variables, columns, name: index_name)
end end
end end
...@@ -20,7 +25,7 @@ class AddUniqueConstraintToCiVariables < ActiveRecord::Migration ...@@ -20,7 +25,7 @@ class AddUniqueConstraintToCiVariables < ActiveRecord::Migration
private private
def this_index_exists? def this_index_exists?
index_exists?(:ci_variables, name: index_name) index_exists?(:ci_variables, columns, name: index_name)
end end
def columns 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