summaryrefslogtreecommitdiff
path: root/db/post_migrate/20230317151841_remove_from_to_state_constraint.rb
blob: 21913d394d19b2fe12193db5b236f0715bb4ffff (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 RemoveFromToStateConstraint < Gitlab::Database::Migration[2.1]
  disable_ddl_transaction!

  def up
    constraint_name = check_constraint_name(
      'vulnerability_state_transitions',
      'fully_qualified_table_name',
      'state_not_equal')
    remove_check_constraint(:vulnerability_state_transitions, constraint_name)
  end

  def down
    constraint_name = check_constraint_name(
      'vulnerability_state_transitions',
      'fully_qualified_table_name',
      'state_not_equal')
    add_check_constraint(:vulnerability_state_transitions, '(from_state != to_state)', constraint_name)
  end
end