-
Notifications
You must be signed in to change notification settings - Fork 548
Description
Context
apps/stripe uses @supabase/stripe-sync-engine: ^0.45.0. Latest is 0.48.2.
We previously patched supabase/migrations/20250101000005_stripe_fix_entitlement_unique.sql manually because active_entitlements.lookup_key had a buggy unique constraint. That patch dropped the original unique and replaced it with a composite (customer, lookup_key) unique.
This bug is officially fixed in v0.48.2 via 0042_remove_lookup_key_unique.sql, which drops unique constraints on both active_entitlements.lookup_key and features.lookup_key (no replacement). Our patch missed features entirely.
Steps
1. Bump version in apps/stripe/package.json:
"@supabase/stripe-sync-engine": "^0.48.2"
2. Add 3 migration files (ports of upstream 0040–0042):
supabase/migrations/20241201000040_stripe_invoice_payments.sql — new invoice_payments table (v0.48.0)
supabase/migrations/20241201000041_stripe_add_billing_mode.sql — adds billing_mode jsonb to subscriptions + subscription_schedules (v0.48.1)
supabase/migrations/20241201000042_stripe_remove_lookup_key_unique.sql — drop buggy uniques (v0.48.2). Must also drop our custom composite constraint not present in upstream:
ALTER TABLE stripe.active_entitlements DROP CONSTRAINT IF EXISTS active_entitlements_lookup_key_key;
ALTER TABLE stripe.active_entitlements DROP CONSTRAINT IF EXISTS active_entitlements_customer_lookup_key_key;
ALTER TABLE stripe.features DROP CONSTRAINT IF EXISTS features_lookup_key_key;3. pnpm install then apply migrations (supabase db push or via hosted dashboard).
Notes
- Upstream SQL for 0040–0042: https://github.com/supabase/stripe-sync-engine/tree/main/packages/sync-engine/src/database/migrations
- Release notes: https://github.com/supabase/stripe-sync-engine/releases
Metadata
Metadata
Assignees
Labels
Type
Projects
Status