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

20231006154748_replace_value_stream_project_ids_filter_constraint.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ea3e97eb85f6d0398da872e6512679d229138f07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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