提交 fcb6dd68 编写于 作者: T Tiago Botelho

Adds unique constraint to ProjectMirrorData project_id index

上级 4caf58a1
class AddUniqueConstraintToProjectMirrorDataProjectIdIndex < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index(:project_mirror_data,
:project_id,
unique: true,
name: 'index_project_mirror_data_on_project_id_unique')
remove_concurrent_index_by_name(:project_mirror_data, 'index_project_mirror_data_on_project_id')
rename_index(:project_mirror_data,
'index_project_mirror_data_on_project_id_unique',
'index_project_mirror_data_on_project_id')
end
def down
rename_index(:project_mirror_data,
'index_project_mirror_data_on_project_id',
'index_project_mirror_data_on_project_id_old')
add_concurrent_index(:project_mirror_data, :project_id)
remove_concurrent_index_by_name(:project_mirror_data,
'index_project_mirror_data_on_project_id_old')
end
end
......@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20180508100222) do
ActiveRecord::Schema.define(version: 20180508102840) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
......@@ -1536,7 +1536,7 @@ ActiveRecord::Schema.define(version: 20180508100222) do
end
add_index "project_mirror_data", ["jid"], name: "index_project_mirror_data_on_jid", using: :btree
add_index "project_mirror_data", ["project_id"], name: "index_project_mirror_data_on_project_id", using: :btree
add_index "project_mirror_data", ["project_id"], name: "index_project_mirror_data_on_project_id", unique: true, using: :btree
add_index "project_mirror_data", ["status"], name: "index_project_mirror_data_on_status", using: :btree
create_table "project_statistics", force: :cascade do |t|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册