Jack
Explore posts from serversDTDrizzle Team
•Created by Jack on 10/3/2024 in #help
Drizzle migration, any way to create an index BEFORE the constraints are added to tables?
I have a multi-tenanted application whereby I store the tenant ID on as many tables as possible. I want to ensure each table has the correct pairing of the userId to the tenantId using a unique index pairing the two columns in the users table, then enforcing that pairing as a foreign key constraint on the tables that reference a userId and tenantId. However, the generated migration file creates the indexes AFTER the constraints are added, causing the migration to fail. I can edit this migration and move the line further up, but for me that defeats the purpose of a lot of the autonomy migrations give me. 😅 Any ideas or help? Thanks a lot
1 replies
DTDrizzle Team
•Created by Jack on 6/1/2024 in #help
db.insert(Table).values() gives TypeScript error "Object literal may only specify known properties"
Before I begin, let me clarify I am suuuper new to Drizzle! Loving it so far!
Not sure if I should provide repro just yet (happy to later), but I am getting an issue where my table which currently is:
Is giving me this a long typescript error for the
values
method that basically boils down to this:
Object literal may only specify known properties, and authorId does not exist in type ...
When I run:
I feel like I am missing something basic, but I am scratching my head a bit! 😅
I have been able to successfully use the values
method with no problems with very similar other tables.
Thanks so much2 replies