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

class AddComponentForeignKeyToSbomOccurrences < Gitlab::Database::Migration[2.0]
  disable_ddl_transaction!

  def up
    add_concurrent_foreign_key :sbom_occurrences,
      :sbom_components,
      column: :component_id,
      on_delete: :cascade
  end

  def down
    with_lock_retries do
      remove_foreign_key :sbom_occurrences, column: :component_id
    end
  end
end