Commit 5e5d04e6 authored by Adam Hegyi's avatar Adam Hegyi

Merge branch 'ab/lock-retries-cascading-settings' into 'master'

Use migration level lock-retries for cascading settings

See merge request gitlab-org/gitlab!69886
parents 35a0220f 6ea6cdd7
......@@ -41,6 +41,8 @@ Settings are not cascading by default. To define a cascading setting, take the f
class AddDelayedProjectRemovalCascadingSetting < Gitlab::Database::Migration[1.0]
include Gitlab::Database::MigrationHelpers::CascadingNamespaceSettings
enable_lock_retries!
def up
add_cascading_namespace_setting :delayed_project_removal, :boolean, default: false, null: false
end
......
......@@ -31,10 +31,8 @@ module Gitlab
namespace_options = options.merge(null: true, default: nil)
with_lock_retries do
add_column(:namespace_settings, setting_name, type, namespace_options)
add_column(:namespace_settings, lock_column_name, :boolean, default: false, null: false)
end
add_column(:application_settings, setting_name, type, options)
add_column(:application_settings, lock_column_name, :boolean, default: false, null: false)
......@@ -43,10 +41,8 @@ module Gitlab
def remove_cascading_namespace_setting(setting_name)
lock_column_name = "lock_#{setting_name}".to_sym
with_lock_retries do
remove_column(:namespace_settings, setting_name) if column_exists?(:namespace_settings, setting_name)
remove_column(:namespace_settings, lock_column_name) if column_exists?(:namespace_settings, lock_column_name)
end
remove_column(:application_settings, setting_name) if column_exists?(:application_settings, setting_name)
remove_column(:application_settings, lock_column_name) if column_exists?(:application_settings, lock_column_name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment