Commit eea422b0 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents b5e029b1 e0ba63c8
...@@ -205,6 +205,30 @@ def down ...@@ -205,6 +205,30 @@ def down
end end
``` ```
**Multiple changes on the same table:**
The helper `with_lock_retries` wraps all operations into a single transaction. When you have the lock,
you should do as much as possible inside the transaction rather than trying to get another lock later.
Be careful about running long database statements within the block. The acquired locks are kept until the transaction (block) finishes and depending on the lock type, it might block other database operations.
```ruby
include Gitlab::Database::MigrationHelpers
def up
with_lock_retries do
add_column :users, :full_name, :string
add_column :users, :bio, :string
end
end
def down
with_lock_retries do
remove_column :users, :full_name
remove_column :users, :bio
end
end
```
**Removing a foreign key:** **Removing a foreign key:**
```ruby ```ruby
......
...@@ -55,7 +55,7 @@ module Security ...@@ -55,7 +55,7 @@ module Security
when 'packager' when 'packager'
collection.sort_by! { |a| a[:packager] } collection.sort_by! { |a| a[:packager] }
when 'severity' when 'severity'
sort_dependency_vulnerabilities_by_severity!(collection) if Feature.enabled?(:sort_dependency_vulnerabilities, @pipeline.project) sort_dependency_vulnerabilities_by_severity!(collection) if Feature.enabled?(:sort_dependency_vulnerabilities, @pipeline.project, default_enabled: true)
sort_dependencies_by_severity!(collection) sort_dependencies_by_severity!(collection)
else else
collection.sort_by! { |a| a[:name] } collection.sort_by! { |a| a[:name] }
......
...@@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/332852 ...@@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/332852
milestone: '14.0' milestone: '14.0'
type: development type: development
group: group::composition analysis group: group::composition analysis
default_enabled: false default_enabled: true
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