Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
6ea6cdd7
Commit
6ea6cdd7
authored
Sep 08, 2021
by
Andreas Brandl
Committed by
Adam Hegyi
Sep 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use migration level lock-retries
parent
30cce575
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
8 deletions
+6
-8
doc/development/cascading_settings.md
doc/development/cascading_settings.md
+2
-0
lib/gitlab/database/migration_helpers/cascading_namespace_settings.rb
...atabase/migration_helpers/cascading_namespace_settings.rb
+4
-8
No files found.
doc/development/cascading_settings.md
View file @
6ea6cdd7
...
@@ -41,6 +41,8 @@ Settings are not cascading by default. To define a cascading setting, take the f
...
@@ -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]
class AddDelayedProjectRemovalCascadingSetting < Gitlab::Database::Migration[1.0]
include Gitlab::Database::MigrationHelpers::CascadingNamespaceSettings
include Gitlab::Database::MigrationHelpers::CascadingNamespaceSettings
enable_lock_retries!
def up
def up
add_cascading_namespace_setting :delayed_project_removal, :boolean, default: false, null: false
add_cascading_namespace_setting :delayed_project_removal, :boolean, default: false, null: false
end
end
...
...
lib/gitlab/database/migration_helpers/cascading_namespace_settings.rb
View file @
6ea6cdd7
...
@@ -31,10 +31,8 @@ module Gitlab
...
@@ -31,10 +31,8 @@ module Gitlab
namespace_options
=
options
.
merge
(
null:
true
,
default:
nil
)
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
,
setting_name
,
type
,
namespace_options
)
add_column
(
:namespace_settings
,
lock_column_name
,
:boolean
,
default:
false
,
null:
false
)
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
,
setting_name
,
type
,
options
)
add_column
(
:application_settings
,
lock_column_name
,
:boolean
,
default:
false
,
null:
false
)
add_column
(
:application_settings
,
lock_column_name
,
:boolean
,
default:
false
,
null:
false
)
...
@@ -43,10 +41,8 @@ module Gitlab
...
@@ -43,10 +41,8 @@ module Gitlab
def
remove_cascading_namespace_setting
(
setting_name
)
def
remove_cascading_namespace_setting
(
setting_name
)
lock_column_name
=
"lock_
#{
setting_name
}
"
.
to_sym
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
,
setting_name
)
if
column_exists?
(
:namespace_settings
,
setting_name
)
remove_column
(
:namespace_settings
,
lock_column_name
)
if
column_exists?
(
:namespace_settings
,
lock_column_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
,
setting_name
)
if
column_exists?
(
:application_settings
,
setting_name
)
remove_column
(
:application_settings
,
lock_column_name
)
if
column_exists?
(
:application_settings
,
lock_column_name
)
remove_column
(
:application_settings
,
lock_column_name
)
if
column_exists?
(
:application_settings
,
lock_column_name
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment