summaryrefslogtreecommitdiff
path: root/db/migrate/20160808085602_add_index_for_build_token.rb
blob: 6c5d7268e7201ca9a1b9be90d3224bfb147935c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class AddIndexForBuildToken < 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_builds, :token, unique: true
  end

  def down
    remove_index :ci_builds, :token, unique: true if index_exists? :ci_builds, :token, unique: true
  end
end