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
-
Run GDK in SaaS mode.
-
Go to
/admin/groups/<group>/editfor a group on Premium, change Plan to Ultimate, and save. -
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.