[Plan] Update application code to use new plan associations and enum identifiers

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

Objective

Update models, controllers, services, and business logic throughout the application to use the new plan associations and enum identifiers exclusively.

Remove the usage of old plan_id and association from the codebase.

Prerequisites

  • Plan model associations updated (#571421 (closed))

Scope

Update application code in:

  • Models to remove id usage in Plan model and plan_id or hosted_plan_id usage in referencing models
  • Controllers (Fulfillment, Admin, API)
  • Services and business logic
  • Background jobs
  • GraphQL resolvers
  • Queries and scopes
  • JiHu-specific implementations

Tasks

  • Models to remove id usage in Plan model and plan_id or hosted_plan_id usage in referencing models
  • Audit and update controllers using plan relationships
  • Update services and business logic classes
  • Update GraphQL resolvers and mutations
  • Update background jobs that reference plans
  • Update queries to use new foreign keys
  • Update scopes and finder methods
  • Handle JiHu-specific code changes
  • Update API endpoints and serializers
  • Update admin interfaces
  • Update any hardcoded plan ID references to use enum values

Code Areas to Update

Based on analysis, likely areas include:

  • app/models/plans and association remove the plan_id
  • app/controllers/admin/plans_controller.rb
  • app/services/gitlab_subscriptions/
  • app/graphql/resolvers/
  • ee/app/models/gitlab_subscription.rb
  • ee/app/services/
  • Background job classes
  • API serializers

Testing Strategy

  • Update model tests
  • Update controller tests
  • Update service tests
  • Update GraphQL tests
  • Update integration tests
  • Add tests for enum usage
  • Validate API responses

Acceptance Criteria

  • All models use new plan associations exclusively
    • no usage of old plan_id or hosted_plan_id along with id in Plan model
  • All controllers use new plan associations
  • All services use enum identifiers
  • GraphQL resolvers updated
  • Background jobs updated
  • All tests pass
  • JiHu-specific code updated
  • API responses remain consistent
  • No performance regressions

References

  • Parent Epic: Convert `plans` table to be hard-coded in appli... (&19409)
  • Original Issue: #519892 (closed)
  • Previous: #571421 (closed)
Edited Jan 13, 2026 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading