Commit b19248c3 authored by Andreas Brandl's avatar Andreas Brandl

Merge branch 'tc-unique-design-project_id' into 'master'

Add unique constraint design_registry.project_id

Closes #33545

See merge request gitlab-org/gitlab!18201
parents 5ba74587 9cdf2dc5
# frozen_string_literal: true
class AddUniqueConstraintOnDesignRegistryProjectId < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'index_design_registry_on_project_id'
def change
# `design_registry` is not in use yet, so no need to create index concurrently
remove_index :design_registry, column: :project_id, name: INDEX_NAME # rubocop: disable Migration/RemoveIndex
add_index :design_registry, :project_id, name: INDEX_NAME, unique: true # rubocop: disable Migration/AddIndex
end
end
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2019_09_23_111102) do
ActiveRecord::Schema.define(version: 2019_10_07_122326) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
......@@ -38,7 +38,7 @@ ActiveRecord::Schema.define(version: 2019_09_23_111102) do
t.datetime "retry_at"
t.datetime "last_synced_at"
t.datetime "created_at", null: false
t.index ["project_id"], name: "index_design_registry_on_project_id"
t.index ["project_id"], name: "index_design_registry_on_project_id", unique: true
t.index ["retry_at"], name: "index_design_registry_on_retry_at"
t.index ["state"], name: "index_design_registry_on_state"
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