Amruth Pillai
Explore posts from serversPPrisma
•Created by Amruth Pillai on 6/27/2024 in #help-and-questions
Accessing extended operations on the prisma client with typescript
4 replies
PPrisma
•Created by Amruth Pillai on 6/27/2024 in #help-and-questions
Accessing extended operations on the prisma client with typescript
4 replies
DTDrizzle Team
•Created by joshborseth on 9/14/2023 in #help
TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys')
I'm getting this error when running
drizzle-kit push
on the latest version (0.21.0
) as well, with the postgresql dialect.
The schema has a lot of tables with composite primary keys, but most of them look like this:
This used to work as expected in the older versions, but it's become a problem now.44 replies
DTDrizzle Team
•Created by turtles#7560074 on 3/10/2024 in #help
created_at/updated_at
I use this:
Both values would be initialised to the current date.
To set up
updatedAt
, the recommended method is to just set updatedAt: new Date()
when you are updating a record.3 replies
DTDrizzle Team
•Created by _Pear on 3/3/2024 in #help
Is it possible to store an array of primary keys for table A on table B using Postgres?
It sounds like what you are trying to create is a bridge/junction table? But I'm quite not sure.
In any case, yes, you cannot have multiple primary keys in a single table, but you can have composite primary keys (PKs that constitute of two or more columns).
In Drizzle for example, this is how you would do that:
Here,
taskId
and userId
are both references to PKs on a different table, but used in union as a primary key to ensure there are never two rows which have the same task and user ID. You can add more columns to this primary key simply by appending the array.7 replies