Commit 8c005072 authored by Rubén Dávila's avatar Rubén Dávila

Deletes gitlab_subscriptions through the app

This is required to avoid an error when re-generating the FK due to
orphaned records. See more https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/8871#note_125503270
parent 5fc0322d
......@@ -31,7 +31,7 @@ module EE
belongs_to :plan
has_one :namespace_statistics
has_one :gitlab_subscription
has_one :gitlab_subscription, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
scope :with_plan, -> { where.not(plan_id: nil) }
......
......@@ -8,7 +8,7 @@ describe Namespace do
let!(:gold_plan) { create(:gold_plan) }
it { is_expected.to have_one(:namespace_statistics) }
it { is_expected.to have_one(:gitlab_subscription) }
it { is_expected.to have_one(:gitlab_subscription).dependent(:destroy) }
it { is_expected.to belong_to(:plan) }
it { is_expected.to delegate_method(:shared_runners_minutes).to(:namespace_statistics) }
......
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