BanchanArt / banchan

The Co-Operative Commissions Platform
https://banchan.art
Other
169 stars 31 forks source link

Use trigger to schedule upload data deletion #787

Closed zkat closed 7 months ago

zkat commented 8 months ago

Right now, we do this manually in every delete function. This really isn't gonna scale, esp with delete constraints.

Instead, create a trigger that will fire every time an upload row gets deleted, and have a GenServer listen for that event and schedule the deletion with UploadDeleter.

See https://peterullrich.com/listen-to-database-changes-with-postgres-triggers-and-elixir