Live data from Hacker News

How Postgres Triggers Can Simplify Your Back End Development

themythicalengineer.com

111–112 of 112 posts

Re: How Postgres Triggers Can Simplify Your Back End Development

#111
I used them once when I was a young engineer, then quickly realised how much I hated them because of how much they obscured the logic of my application. I hadn't even started to worry about migrations at that point.

Been first in all my teams since then to loudly voice my opposition when someone suggests it as a quick fix for something more complicated

Re: How Postgres Triggers Can Simplify Your Back End Development

#112
post #87
post #53

Earlier quoted context omitted.

I don't think migrations (at least as done by Django et al.) solve it - you want a declarative source of truth for what the schema looks like today , not a chain of changes that only tell you that after computing the combined effect. Even if they just created a generated file of the final schema, that sat in version control and errored the makemigrations check (just like a missing migration) if it was out of sync, th…

One of my pet projects addresses these points you raise about Django + migrations, have a look: https://pypi.org/project/DBSamizdat In a nutshell it allows you to keep DB functions, triggers and views around as Python classes, so you can version them together with the rest of your application code. The DB state gets updated for you (in the right dependency order) whenever you change them. It can also run without Djan…

This is exactly what I would use dbt for
Post reply on HN