Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20230317151841_remove_from_to_state_constraint.rb')
-rw-r--r--db/post_migrate/20230317151841_remove_from_to_state_constraint.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/db/post_migrate/20230317151841_remove_from_to_state_constraint.rb b/db/post_migrate/20230317151841_remove_from_to_state_constraint.rb
new file mode 100644
index 00000000000..21913d394d1
--- /dev/null
+++ b/db/post_migrate/20230317151841_remove_from_to_state_constraint.rb
@@ -0,0 +1,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