We migrated to SQL. Our biggest learning? Don't use Prisma ORM
codedamn.com
codedamn.com
I don't know what it is about the TypeScript/JavaScript/NodeJS world that keeps seeking ever more magical and oppressive and comprehensive solutions to accomplish tasks and goals that software has been capable of achieving for some time now.
Knex is a good ORM for a NodeJS back-end. It's simple and generic. It does the job while giving developers sufficient flexibility. I just can never see the appeal of things like Prisma.
I'm able to write raw sql queries with the `sql` template literal function
but personally i handwrite my queries with https://github.com/porsager/postgres for flexibility and performance
most orms use node-pg lib which has shit performance.
- https://www.postgresql.org/docs/current/client-interfaces.ht...
On what makes it postgres.js faster, from author himself:
> it seems Postgres.js is actually faster than, not only pg, but of any driver out-there
Using MongoDb with AWS Lambda and join it with 10 another services to serve a GraphQL endpoint just sounds much better than any PHP/Python REST API backed by MySQL. No wonder you'll end up from time to time with things you'll deeply regret.
That, and the existence and popularity of things like left-pad, speaks volumes.
That said, it is true that the Node/JS world is primarily hype-driven by "thought leaders" and people seeking personal brand and clout. Go on JS/React Twitter and prepare to loudly groan at the self importance on display.
There are good packages out there that try to do things in a sane way without wasting your time. Postgres.js [1] is one of them.
The only Problem with the JS ecosystem, is that we need more discussion of the drawbacks, like this article. Too often, a new solution is paraded as the definitive next step, before we can even know that. On the other hand it's neat that I can mix and match my dependencies based on how progressive/conservative I want to be.
(Knex isn't an ORM)
And yes, we tried to reset our migrations as per the docs. Doesn'tmwork.
FYI, if you use findMany it pulls the ids then uses the ids for its update. They consider using UPDATE an optimization request. WTF?
In general though, I agree with your premise - I don’t understand why people are so reluctant to learn SQL. It’s not a difficult language. Understanding the quirks of your RDBMS, sure. But the base language? Nah.
This is terrifying. OTOH they were coming from MongoDB, so what were they expecting? A sane DB layer? /s
“I’ll just SELECT * from all these tables, and figure out what I want in my app.”