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

20230322162512_add_valid_deploy_access_level_constraint.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4cf82375563524c3802f121155e9efbc2b8205a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

class AddValidDeployAccessLevelConstraint < Gitlab::Database::Migration[2.1]
  disable_ddl_transaction!

  CONSTRAINT_NAME = 'check_deploy_access_levels_user_group_access_level_any_not_null'
  CONSTRAINT = '(num_nonnulls(user_id, group_id, access_level) = 1)'

  def up
    add_check_constraint :protected_environment_deploy_access_levels, CONSTRAINT, CONSTRAINT_NAME
  end

  def down
    remove_check_constraint :protected_environment_deploy_access_levels, CONSTRAINT_NAME
  end
end