Commit d91a7780 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Change uniqueness contraint on pool_repositories

This allows creating a `PoolRepository` for a source project for each
shard it resides on.
parent a8e3bb2d
# frozen_string_literal: true
class UpdateIndexForPoolRepositories < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
# This index is less restrictive then the one we already have, no need to
# update data.
add_concurrent_index :pool_repositories, [:source_project_id, :shard_id], unique: true
remove_concurrent_index :pool_repositories, :source_project_id
end
def down
remove_concurrent_index :pool_repositories, [:source_project_id, :shard_id], unique: true
add_concurrent_index :pool_repositories, :source_project_id
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_12_04_093410) do
ActiveRecord::Schema.define(version: 2019_12_06_122926) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
......@@ -2969,7 +2969,7 @@ ActiveRecord::Schema.define(version: 2019_12_04_093410) do
t.integer "source_project_id"
t.index ["disk_path"], name: "index_pool_repositories_on_disk_path", unique: true
t.index ["shard_id"], name: "index_pool_repositories_on_shard_id"
t.index ["source_project_id"], name: "index_pool_repositories_on_source_project_id", unique: true
t.index ["source_project_id", "shard_id"], name: "index_pool_repositories_on_source_project_id_and_shard_id", unique: true
end
create_table "programming_languages", id: :serial, force: :cascade do |t|
......
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