B33fb0n3
DTDrizzle Team
•Created by B33fb0n3 on 5/16/2024 in #help
Drizzle doesn't know how to serialize a bigint
When using a defaultValue for a bigint like this:
I will ge the following error when generating the schema:
I am using postgresql
7 replies
DTDrizzle Team
•Created by B33fb0n3 on 4/24/2024 in #help
Duplicate parent
Hey, I have a large schema with many tables and many relations. I would like to duplicate a parent row.
For deletion it's pretty easy: I just reference stuff and then I can delete the parent and everything else will also be deleted. But what about duplication?
How to easily duplicate it without writing every single duplication rule for each table and each children table of the table and ...?
1 replies
DTDrizzle Team
•Created by B33fb0n3 on 4/9/2024 in #help
types for database/transaction
Hey, I have this function:
You can see, that I get a
database
as variable. That can either be a default postgres database (easy to type) or it can be a transaction (how to type). I would like to know how to type them correctly, so I can use users
in this case?
I could do something like this:
But then I can access users
via database.query.users
:/11 replies
DTDrizzle Team
•Created by B33fb0n3 on 3/11/2024 in #help
Ways to check if a user liked
Imagine the following objects in your schema:
Post, Likes, User
.
Imagine also the following relations:
User has many Likes (own made Likes)
Post has many Likes
Likes has one User
Likes has one Post
So Likes
is the join table for the many-to-many connection between "One Post has many likes (from users) and one User has many liked Posts".
If I now want to load a feed, how to effectively check, if the user liked the post, that the user see's in his feed?
By the way: That is not the only part, where this kind of solution append. Imagine having a User, that has many bought products. And one Product has many users who bought that. The join table is then something like "purchase", which contain a one connection
to both: Product and User 13 replies