summaryrefslogtreecommitdiff
path: root/db/migrate/20180425205249_add_index_constraints_to_pipeline_iid.rb
blob: 7daa7197b7c3409b1397191b70e4aa7f4fbdcb14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class AddIndexConstraintsToPipelineIid < ActiveRecord::Migration
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    add_concurrent_index :ci_pipelines, [:project_id, :iid_per_project], unique: true, where: 'iid_per_project IS NOT NULL'
  end

  def down
    remove_concurrent_index :ci_pipelines, [:project_id, :iid_per_project]
  end
end