refactor: Database migration for nullable stripe_customer_id (#205) #207

Closed
opened 2026-02-16 14:53:02 +00:00 by egullickson · 0 comments
Owner

Relates to #205

Milestone 1: Database migration + type definitions

Files

  • backend/src/features/subscriptions/migrations/002_nullable_stripe_customer_id.sql (NEW)
  • backend/src/features/subscriptions/domain/subscriptions.types.ts
  • frontend/src/features/subscription/types/subscription.types.ts

Changes

  1. New migration 002_nullable_stripe_customer_id.sql:

    • ALTER TABLE subscriptions ALTER COLUMN stripe_customer_id DROP NOT NULL
    • UPDATE existing admin_override_* values to NULL
    • UNIQUE constraint preserved (PostgreSQL allows multiple NULLs)
    • Index preserved for query performance
  2. Backend type (subscriptions.types.ts):

    • Subscription interface: change stripeCustomerId: string to stripeCustomerId: string | null
    • SubscriptionResponse type: change stripeCustomerId: string to stripeCustomerId: string | null
    • UpdateSubscriptionData type: change stripeCustomerId?: string to stripeCustomerId?: string | null
  3. Frontend type (subscription.types.ts):

    • Change stripeCustomerId: string to stripeCustomerId: string | null

Acceptance Criteria

  • Migration runs cleanly
  • All admin_override_* values become NULL
  • Backend types compile (Subscription, SubscriptionResponse, UpdateSubscriptionData)
  • Frontend types compile with nullable stripeCustomerId
Relates to #205 ## Milestone 1: Database migration + type definitions ### Files - `backend/src/features/subscriptions/migrations/002_nullable_stripe_customer_id.sql` (NEW) - `backend/src/features/subscriptions/domain/subscriptions.types.ts` - `frontend/src/features/subscription/types/subscription.types.ts` ### Changes 1. **New migration** `002_nullable_stripe_customer_id.sql`: - ALTER TABLE subscriptions ALTER COLUMN stripe_customer_id DROP NOT NULL - UPDATE existing admin_override_* values to NULL - UNIQUE constraint preserved (PostgreSQL allows multiple NULLs) - Index preserved for query performance 2. **Backend type** (`subscriptions.types.ts`): - `Subscription` interface: change `stripeCustomerId: string` to `stripeCustomerId: string | null` - `SubscriptionResponse` type: change `stripeCustomerId: string` to `stripeCustomerId: string | null` - `UpdateSubscriptionData` type: change `stripeCustomerId?: string` to `stripeCustomerId?: string | null` 3. **Frontend type** (`subscription.types.ts`): - Change `stripeCustomerId: string` to `stripeCustomerId: string | null` ### Acceptance Criteria - [ ] Migration runs cleanly - [ ] All admin_override_* values become NULL - [ ] Backend types compile (Subscription, SubscriptionResponse, UpdateSubscriptionData) - [ ] Frontend types compile with nullable stripeCustomerId
egullickson added the
status
backlog
type
feature
labels 2026-02-16 14:53:32 +00:00
egullickson added this to the Sprint 2026-02-02 milestone 2026-02-16 14:53:35 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: egullickson/motovaultpro#207