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/migrate/20231006154748_replace_value_stream_project_ids_filter_constraint.rb')
-rw-r--r--db/migrate/20231006154748_replace_value_stream_project_ids_filter_constraint.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/db/migrate/20231006154748_replace_value_stream_project_ids_filter_constraint.rb b/db/migrate/20231006154748_replace_value_stream_project_ids_filter_constraint.rb
new file mode 100644
index 00000000000..ea3e97eb85f
--- /dev/null
+++ b/db/migrate/20231006154748_replace_value_stream_project_ids_filter_constraint.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class ReplaceValueStreamProjectIdsFilterConstraint < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ OLD_CONSTRAINT_NAME = 'chk_rails_a91b547c97'
+ NEW_CONSTRAINT_NAME = 'project_ids_filter_array_check'
+
+ def up
+ remove_check_constraint :analytics_cycle_analytics_value_stream_settings, OLD_CONSTRAINT_NAME
+
+ check = '((CARDINALITY(project_ids_filter) <= 100) AND (ARRAY_POSITION(project_ids_filter, null) IS null))'
+ add_check_constraint :analytics_cycle_analytics_value_stream_settings, check, NEW_CONSTRAINT_NAME
+ end
+
+ def down
+ remove_check_constraint :analytics_cycle_analytics_value_stream_settings, NEW_CONSTRAINT_NAME
+
+ check = '(CARDINALITY(project_ids_filter) <= 100)'
+ add_check_constraint :analytics_cycle_analytics_value_stream_settings, check, OLD_CONSTRAINT_NAME
+ end
+end