Commit f9f16ade authored by Dylan Griffith's avatar Dylan Griffith

Remove User#triggers dependent: :destroy

This does not appear to be necessary. It was first added in
https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9713#note_24835526
and there does not appear to be any justification for this as there is
already a cascading foreign key delete. There don't appear to be any
`before_destroy` or similar steps that might benefit from this
`dependent: :destroy` so it seems safe to remove it.
parent 5a614293
...@@ -187,7 +187,7 @@ class User < ApplicationRecord ...@@ -187,7 +187,7 @@ class User < ApplicationRecord
has_many :todos has_many :todos
has_many :notification_settings has_many :notification_settings
has_many :award_emoji, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent has_many :award_emoji, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
has_many :triggers, dependent: :destroy, class_name: 'Ci::Trigger', foreign_key: :owner_id # rubocop:disable Cop/ActiveRecordDependent has_many :triggers, class_name: 'Ci::Trigger', foreign_key: :owner_id
has_many :issue_assignees, inverse_of: :assignee has_many :issue_assignees, inverse_of: :assignee
has_many :merge_request_assignees, inverse_of: :assignee has_many :merge_request_assignees, inverse_of: :assignee
......
...@@ -109,7 +109,6 @@ RSpec.describe User do ...@@ -109,7 +109,6 @@ RSpec.describe User do
it { is_expected.to have_many(:spam_logs).dependent(:destroy) } it { is_expected.to have_many(:spam_logs).dependent(:destroy) }
it { is_expected.to have_many(:todos) } it { is_expected.to have_many(:todos) }
it { is_expected.to have_many(:award_emoji).dependent(:destroy) } it { is_expected.to have_many(:award_emoji).dependent(:destroy) }
it { is_expected.to have_many(:triggers).dependent(:destroy) }
it { is_expected.to have_many(:builds).dependent(:nullify) } it { is_expected.to have_many(:builds).dependent(:nullify) }
it { is_expected.to have_many(:pipelines).dependent(:nullify) } it { is_expected.to have_many(:pipelines).dependent(:nullify) }
it { is_expected.to have_many(:chat_names).dependent(:destroy) } it { is_expected.to have_many(:chat_names).dependent(:destroy) }
......
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