Commit e542583e authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add a unique index to stages on pipeline / position

parent 74caf547
class AddIndexToStagesPosition < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :ci_stages, [:pipeline_id, :position], unique: true
end
def down
remove_concurrent_index :ci_stages, [:pipeline_id, :position]
end
end
......@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20180529093006) do
ActiveRecord::Schema.define(version: 20180530135500) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
......@@ -518,6 +518,7 @@ ActiveRecord::Schema.define(version: 20180529093006) do
end
add_index "ci_stages", ["pipeline_id", "name"], name: "index_ci_stages_on_pipeline_id_and_name", unique: true, using: :btree
add_index "ci_stages", ["pipeline_id", "position"], name: "index_ci_stages_on_pipeline_id_and_position", unique: true, using: :btree
add_index "ci_stages", ["pipeline_id"], name: "index_ci_stages_on_pipeline_id", using: :btree
add_index "ci_stages", ["project_id"], name: "index_ci_stages_on_project_id", using: :btree
......
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