Split subscription items into a separate table
kiwicopple opened this issue · comments
Copple commented
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 theprice
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