summaryrefslogtreecommitdiff
path: root/db/migrate/20200420172752_add_sprints_foreign_key_to_projects.rb
blob: 46b5c9c2ac2311dd1255454a2a8b47ceceee979a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

class AddSprintsForeignKeyToProjects < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    add_concurrent_foreign_key :sprints, :projects, column: :project_id, on_delete: :cascade
  end

  def down
    with_lock_retries do
      remove_foreign_key :sprints, column: :project_id
    end
  end
end