blob: 74236993fff58c165f7a0bf972ea856604eec2e2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# frozen_string_literal: true
# See https://docs.gitlab.com/ee/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class AddYamlLimitConstraints < ActiveRecord::Migration[6.1]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
SIZE_CONSTRAINT_NAME = 'app_settings_yaml_max_size_positive'
DEPTH_CONSTRAINT_NAME = 'app_settings_yaml_max_depth_positive'
disable_ddl_transaction!
def up
add_check_constraint :application_settings, 'max_yaml_size_bytes > 0', SIZE_CONSTRAINT_NAME
add_check_constraint :application_settings, 'max_yaml_depth > 0', DEPTH_CONSTRAINT_NAME
end
def down
remove_check_constraint :application_settings, SIZE_CONSTRAINT_NAME
remove_check_constraint :application_settings, DEPTH_CONSTRAINT_NAME
end
end
|