PapaFinn
DTDrizzle Team
•Created by PapaFinn on 7/10/2024 in #help
Inner joining and left joining the same table (aliased) causes the return type to be never
I'm getting a weird issue where if I make two table aliases for the same table and then inner join one while left joining the other, the return type of my query ends up being
never[]
.
Unfortunately the type of data becomes:
I've reduced the Company table to the smallest it could possibly be but it makes absolutely no difference:
Interestingly, if both joins to the Company
table are left joins or if both joins are inner joins, it works fine, but that's not my intended behavior.
What am I missing here? 🤔16 replies
DTDrizzle Team
•Created by PapaFinn on 6/20/2023 in #help
Extracting literal values from Drizzle enums
I'm trying to make a zod enum schema from the values of a Drizzle enum I've created. I've looked through several other posts trying to do the same thing and it's unclear to me how to do this, particularly for
mysqlEnum
. The most promising way came from inspecting the enums at runtime. I found that I could access the values, just as I wanted, at myEnum.config.enumValues
. The only problem is that Typescript declares config protected and I get type errors.7 replies
DTDrizzle Team
•Created by PapaFinn on 4/27/2023 in #help
Does Drizzle support MySQL's LAST_INSERT_ID function?
I'm wanting to return a newly created record in the db immediately after a POST. MySQL doesn't support
returning
so it seems the alternative is a separate request in the same transaction that fetches the new record. It appears that the easiest way to do this is with MySQL's LAST_INSERT_ID
function. Does Drizzle support this or does this have to be done with raw SQL?12 replies