Three tables + lifecycle enum for Razorpay subscriptions: - subscription_plans: maps razorpay_plan_id -> grants (price/storage/member/child) - family_subscriptions: per-family sub state mirrored from Razorpay - razorpay_webhook_events: append-only log, razorpay_event_id = idempotency key - subscription_status_enum: mirrors Razorpay's lifecycle states exactly - partial unique index family_live_sub_idx: at most one non-terminal sub/family Notes: - Raw-SQL + Drizzle schema both added (repo uses raw sql`` at runtime; schema file keeps drizzle-kit + type inference working) - child_limit added to plan (not in original handoff) since premium lifts the free 1-baby cap to 3 per product decision - Migration 0012 idempotent; also added to debug-migration hot-apply steps - when=1780100000000 (> last entry, per journal drift rule) Entitlement will sync onto families.tier (Task 3/5) so existing quota.ts guards stay unchanged — these tables are audit + Razorpay state mirror. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| __tests__ | ||
| app | ||
| components | ||
| db | ||
| hooks | ||
| lib | ||
| scripts | ||
| types | ||
| auth.ts | ||
| middleware.ts | ||