Commit 592e0877 authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg Committed by Kamil Trzcinski

Add unique index on job_id and file_type

parent ab02bd69
class UniquenessContraintJobArtifactFileType < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :ci_job_artifacts, [:job_id, :file_type], unique: true
end
def down
remove_concurrent_index :ci_job_artifacts, [:job_id, :file_type]
end
end
......@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20171124150326) do
ActiveRecord::Schema.define(version: 20171130145523) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
......@@ -330,6 +330,7 @@ ActiveRecord::Schema.define(version: 20171124150326) do
end
add_index "ci_job_artifacts", ["file_type"], name: "index_ci_job_artifacts_on_file_type", using: :btree
add_index "ci_job_artifacts", ["job_id", "file_type"], name: "index_ci_job_artifacts_on_job_id_and_file_type", unique: true, using: :btree
add_index "ci_job_artifacts", ["job_id"], name: "index_ci_job_artifacts_on_job_id", using: :btree
add_index "ci_job_artifacts", ["project_id"], name: "index_ci_job_artifacts_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