summaryrefslogtreecommitdiff
path: root/db/post_migrate/20221025115006_check_vulnerabilities_state_transition_from_state_not_equal_to_state.rb
blob: 2ab7f8a9c04cec9ca8b596e9b97fd5d21996b3f1 (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 CheckVulnerabilitiesStateTransitionFromStateNotEqualToState < Gitlab::Database::Migration[2.0]
  disable_ddl_transaction!

  def up
    add_check_constraint(:vulnerability_state_transitions, '(from_state != to_state)', constraint_name)
  end

  def down
    remove_check_constraint(:vulnerability_state_transitions, constraint_name)
  end

  private

  def constraint_name
    check_constraint_name('vulnerability_state_transitions', 'fully_qualified_table_name', 'state_not_equal')
  end
end