Need syntax help
I've been trying out drizzle for a couple hours, and was wondering if there's any way to replicate this action from prisma:
Is there an equivalent to this way of creating a session that's just as efficient? The main appeal is the "connectOrCreate" functionality.
6 Replies
Hello, @x! You can find solution here:
https://discord.com/channels/1043890932593987624/1193450178217254942
Ah, so just combine several queries in one transaction. Appreciate the help 🙏
May I ask what the point of relations are if actions such as this one aren't a thing?
They were designed for avoiding multiple joins and complex data mapping, but honestly, I don't have right answer, as I am not drizzle developer:)
So I can just remove the parts that I crossed out, and keep the squared part, and then just use that userId for all my queries / mutations?
I guess that's now relations work under the hood, but it seems weird to allow relations and have them be near-useless 😭
yes, you are right! Also, you can read docs about relations and foreign keys
https://orm.drizzle.team/docs/rqb#foreign-keys
Drizzle ORM - Query
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.