Handles schemas for various tables including:
track_plays: logs each track play in thenext-app, tying it to user if they are logged in.purchases: logs each purchase attempt, tracking the status of the purchase.purchase_methods: enum table of purchase types (PayPal,Credit/Debit Card,USDC,Apple Pay)purchase_status: enum table of purchase statuses (inflight,processing,confirmed,error)
- The
next-appfirst creates anpurchasesrow withstatus=inflightwhen a user purchases with fiat. - Once the
catalog-rest-apireceives a webhook fromPayPalwe set it toprocessing. - When we actually complete an onchain transaction to fulfill it, we set it to
confirmed.
- Whenever a track begins playing in the
next-app, we create a row in thetrack_playstable. - After
30 secondswe update the listen duration to30 seconds. - Upon finishing the track, we update the listen duration to the full duration of the track.
- Bun
- Doppler CLI
bun installMake changes in the entities directory
Generate migration with
bun migrate:generatebun migratebun migrate:down- Ensure Doppler is configured (using the
catalog-radioproject)
- The above migration scripts apply migrations directly to the production instance of the database.
- The production instance lives on
railwayunder thecatalog-audit-dbproject. - You can view the tables, and find the commands to connect to this database on
railwayas well.