diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 12:40:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 12:40:42 +0300 |
commit | ee664acb356f8123f4f6b00b73c1e1cf0866c7fb (patch) | |
tree | f8479f94a28f66654c6a4f6fb99bad6b4e86a40e /db/migrate/20220901092853_update_can_create_group_application_setting.rb | |
parent | 62f7d5c5b69180e82ae8196b7b429eeffc8e7b4f (diff) |
Add latest changes from gitlab-org/gitlab@15-5-stable-eev15.5.0-rc42
Diffstat (limited to 'db/migrate/20220901092853_update_can_create_group_application_setting.rb')
-rw-r--r-- | db/migrate/20220901092853_update_can_create_group_application_setting.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/db/migrate/20220901092853_update_can_create_group_application_setting.rb b/db/migrate/20220901092853_update_can_create_group_application_setting.rb new file mode 100644 index 00000000000..42508184d62 --- /dev/null +++ b/db/migrate/20220901092853_update_can_create_group_application_setting.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class UpdateCanCreateGroupApplicationSetting < Gitlab::Database::Migration[2.0] + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + value = gitlab_config.respond_to?(:default_can_create_group) ? gitlab_config.default_can_create_group : true + value = Gitlab::Utils.to_boolean(value, default: true) + + execute_update(value: value) + end + + def down + execute_update(value: true) + end + + private + + def execute_update(value:) + execute "UPDATE application_settings SET can_create_group = #{value}" + end + + def gitlab_config + Gitlab.config.gitlab + end +end |