jacobrobertsbaca / zero

Simple zero-based budgeting
https://zerobudget.vercel.app
MIT License
0 stars 0 forks source link

Modify transactions to use triggers on `UPDATE`/`DELETE` #21

Open jacobrobertsbaca opened 10 months ago

jacobrobertsbaca commented 10 months ago

Right now adding, updating, or deleting relies on explicitly calling stored procedures in the database to modify the respective periods for each category. This should be changed to automatically update the periods on any transaction modification without having to explicitly call the procedure.

This simplifies the client interface: we just have to modify the transaction row and the periods are safely updated. It also ensures better database consistency: if I manually delete a transaction in the Supabase dashboard, then I don't have to worry about consistency with the periods table as the trigger will handle it.