Read subscription history plans from SystemDefined::Plan

What does this MR do and why?

SubscriptionHistory now reads its plan from SystemDefined::Plan through hosted_plan_name_uid, like !259099 (merged) does for GitlabSubscription. Nothing in app code reads history.hosted_plan, so no queries change. I also dropped Plan#gitlab_subscription_histories, which was only the inverse of the old association.

I checked a production clone, and every history row with a hosted_plan_id has a matching hosted_plan_name_uid (plan), so old rows read the same plan as before. hosted_plan_id stays tracked until #622081 drops the column.

Part of #571923

How to set up and validate locally

  1. Run GDK in SaaS mode.

  2. Go to /admin/groups/<group>/edit for a group on Premium, change Plan to Ultimate, and save.

  3. In a Rails console, check that the new history row has the old plan:

    Group.find_by_full_path('<group>').gitlab_subscription_histories.last.hosted_plan
    # => #<GitlabSubscriptions::SystemDefined::Plan id: 5, name: "premium", title: "Premium">

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Ryan Cobb

Merge request reports

Loading
Loading