supabase / stripe-sync-engine

Sync your Stripe account to you Postgres database.

Home Page:https://supabase.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Split subscription items into a separate table

kiwicopple opened this issue · comments

The subscription data detailed here is currently stored in JSONB

It would be great to store these rows also in a new table subscription_items. This would be very useful for Supabase as we need to dig into this array to figure out what plan the users are on (Free, Pro, Usage etc). While this can be done with JSONB, it's easier if we can join on the table.

  • create a new table subscription_items (which should reference the price table
  • update the webhook to extract the items from the webhook payload and upsert them into the database
  • run a migration to move all of the existing data into this table