[Plan] Remove old plan associated columns and drop id column from plans table

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

  • Close this issue

Objective

Remove old foreign key constraints, associations, and columns to complete the migration to enum-based plan identifiers.

Prerequisites

  • Foreign key constraints created for new columns (#571423)
  • Validation period completed successfully
  • All systems confirmed working with new associations

Tasks

  • Remove old foreign key constraints:
    • plan_limits.plan_id → plans.id
    • gitlab_subscriptions.hosted_plan_id → plans.id
    • Other old constraints as identified
  • Drop old columns from referencing tables:
    • plan_limits.plan_id
    • gitlab_subscriptions.hosted_plan_id
    • gitlab_subscription_histories.hosted_plan_id
    • Other old columns as identified
  • Drop the id column from plans table
  • Drop the sequence for the old id column
  • Remove old associations from models
  • Clean up any remaining references in code
  • Update database documentation

Safety Measures

  • Comprehensive backup before starting
  • Staged rollout approach
  • Monitor for any issues during deployment
  • Have rollback plan ready
  • Validate all functionality after cleanup

Migration Strategy

  1. Remove old foreign key constraints first
  2. Drop old columns from referencing tables
  3. Drop id column and sequence from plans table
  4. Clean up model associations
  5. Final validation and testing

Acceptance Criteria

  • All old foreign key constraints removed
  • All old columns dropped successfully
  • Plans table uses only name_uid as identifier
  • No references to old id column remain
  • All functionality works correctly
  • Database is clean and optimized
  • Documentation updated

References

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