D1e
D1e
DTDrizzle Team
Created by D1e on 1/11/2024 in #help
MySQL cross database selects?
Nice, exactly that. I also found mysqlTableWithSchema function - seems to be the same - thanks alot!
3 replies
DTDrizzle Team
Created by chronos on 1/11/2024 in #help
Correct way of handling upserts in MySql
Awesome:) It is a little bit oversimplified, but I guess as long as you do simple data update operations and validate your input schemas with something like zod, it should be fairly safe.
5 replies
DTDrizzle Team
Created by chronos on 1/11/2024 in #help
Correct way of handling upserts in MySql
Have just started using drizzle and my first take was this:
const result = await db
.insert(examples)
.values(input)
.onDuplicateKeyUpdate({
set: { ...input },
});

const updated = {
id: result[0].insertId || (input.id as number),
};
return updated;
const result = await db
.insert(examples)
.values(input)
.onDuplicateKeyUpdate({
set: { ...input },
});

const updated = {
id: result[0].insertId || (input.id as number),
};
return updated;
5 replies