BigW Consortium Gitlab

Commit d34e8781 by Lin Jen-Shin

Remove old project_id index and make sure mysql work

parent 5eb4a472
......@@ -6,18 +6,28 @@ class AddUniqueConstraintToCiVariables < ActiveRecord::Migration
disable_ddl_transaction!
def up
unless index_exists?(:ci_variables, columns)
add_concurrent_index(:ci_variables, columns, unique: true)
unless this_index_exists?
add_concurrent_index(:ci_variables, columns, name: index_name, unique: true)
end
end
def down
if index_exists?(:ci_variables, columns) && Gitlab::Database.postgresql?
remove_concurrent_index(:ci_variables, columns)
if this_index_exists? && Gitlab::Database.postgresql?
remove_concurrent_index(:ci_variables, columns, name: index_name)
end
end
private
def this_index_exists?
index_exists?(:ci_variables, name: index_name)
end
def columns
@columns ||= [:project_id, :key, :environment_scope]
end
def index_name
'index_ci_variables_on_project_id_and_key_and_environment_scope'
end
end
class RemoveCiVariablesProjectIdIndex < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
if index_exists?(:ci_variables, :project_id)
remove_concurrent_index(:ci_variables, :project_id)
end
end
def down
unless index_exists?(:ci_variables, :project_id)
add_concurrent_index(:ci_variables, :project_id)
end
end
end
......@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170622135728) do
ActiveRecord::Schema.define(version: 20170623080805) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
......
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