summaryrefslogtreecommitdiff
path: root/db/migrate/20181211092514_add_author_id_index_and_fk_to_releases.rb
blob: f6350a4994470e8d9291f2197c244d19178b060e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

class AddAuthorIdIndexAndFkToReleases < ActiveRecord::Migration[5.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    add_concurrent_index :releases, :author_id

    add_concurrent_foreign_key :releases, :users, column: :author_id, on_delete: :nullify
  end

  def down
    remove_foreign_key :releases, column: :author_id

    remove_concurrent_index :releases, column: :author_id
  end
end