Skip to content
代码片段 群组 项目
未验证 提交 2be6937d 编辑于 作者: Michael Becker's avatar Michael Becker
浏览文件

Ignore `epic_id` column on `vulnerabilities` table

`epic_id` is always `nil` in production:

```sh
[ gstg ] production> Vulnerability.where.not(epic_id: nil).count
=> 0
[ gstg ] production>
```

It was added [when the initial vulnerability table][1] was created, however
appears to have never been used.

This MR ignores the column for step 1 of the
[3-M drop column process][0]

related to: https://gitlab.com/gitlab-org/gitlab/-/issues/268154
Changelog: deprecated

[0]:https://docs.gitlab.com/ee/development/database/avoiding_downtime_in_migrations.html#dropping-columns
[1]:https://gitlab.com/gitlab-org/gitlab/-/commit/8ad1881cc83fa970bf69103e2fcf1ea4175230ff
上级 ecfb6ff1
No related branches found
No related tags found
无相关合并请求
...@@ -5,7 +5,7 @@ class Vulnerability < ApplicationRecord ...@@ -5,7 +5,7 @@ class Vulnerability < ApplicationRecord
include EachBatch include EachBatch
include IgnorableColumns include IgnorableColumns
ignore_column :milestone_id, remove_with: '16.9', remove_after: '2023-01-13' ignore_column %i[epic_id milestone_id], remove_with: '16.9', remove_after: '2023-01-13'
alias_attribute :vulnerability_id, :id alias_attribute :vulnerability_id, :id
......
...@@ -35,8 +35,6 @@ module Vulnerability ...@@ -35,8 +35,6 @@ module Vulnerability
redact_field :description redact_field :description
belongs_to :project # keep this association named 'project' for correct work of markdown cache belongs_to :project # keep this association named 'project' for correct work of markdown cache
belongs_to :epic
belongs_to :author, class_name: 'User' # keep this association named 'author' for correct work of markdown cache belongs_to :author, class_name: 'User' # keep this association named 'author' for correct work of markdown cache
belongs_to :updated_by, class_name: 'User' belongs_to :updated_by, class_name: 'User'
belongs_to :last_edited_by, class_name: 'User' belongs_to :last_edited_by, class_name: 'User'
......
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
subject { build(:vulnerability) } subject { build(:vulnerability) }
it { is_expected.to belong_to(:project) } it { is_expected.to belong_to(:project) }
it { is_expected.to belong_to(:epic) }
it { is_expected.to have_many(:findings).class_name('Vulnerabilities::Finding').inverse_of(:vulnerability) } it { is_expected.to have_many(:findings).class_name('Vulnerabilities::Finding').inverse_of(:vulnerability) }
it { is_expected.to have_many(:dismissed_findings).class_name('Vulnerabilities::Finding').inverse_of(:vulnerability) } it { is_expected.to have_many(:dismissed_findings).class_name('Vulnerabilities::Finding').inverse_of(:vulnerability) }
it { is_expected.to have_many(:merge_request_links).class_name('Vulnerabilities::MergeRequestLink').inverse_of(:vulnerability) } it { is_expected.to have_many(:merge_request_links).class_name('Vulnerabilities::MergeRequestLink').inverse_of(:vulnerability) }
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册