Files
warmbly/internal/infrastructure/db/migrations/000149_managed_plans.down.sql
T
Matthew Meszaros 017f4cf60f feat: plans an operator can grant, visible in the admin panel (#467)
* feat: add operator-granted plans so a workspace can be paid without Stripe, surfaced in the admin panel as a badge, a filter and a card carrying who granted it and why, because the only alternative was writing a fake stripe subscription id into the database

* fix: hold a granted plan beside the paid one rather than over it so a Stripe workspace returns to the plan it pays for when the grant ends, route entitlement lookups through EffectivePlanID, separate a repository failure from an unknown plan, end a grant at local end of day, and drop an index that served no query
2026-09-12 09:45:31 -07:00

14 lines
638 B
SQL

-- Reverses 000149. Every granted plan is forgotten, so a workspace that was
-- paid only because an operator said so becomes unpaid again on the next
-- entitlement check. Nothing else is lost: plan_id was never written by a
-- grant, so a Stripe-backed workspace is already on the plan it pays for.
ALTER TABLE public.subscriptions
DROP CONSTRAINT IF EXISTS subscriptions_managed_complete_check;
ALTER TABLE public.subscriptions
DROP COLUMN IF EXISTS managed_at,
DROP COLUMN IF EXISTS managed_by,
DROP COLUMN IF EXISTS managed_reason,
DROP COLUMN IF EXISTS managed_until,
DROP COLUMN IF EXISTS managed_plan_id;