fixed conflict handling

This commit is contained in:
christian 2024-06-02 07:56:39 +02:00
parent 7590e54392
commit 2c5fcbcbdb

View File

@ -25,7 +25,7 @@ export const addRegion = async (prevstate: any, formData: FormData) => {
const confirmedRegion = await db
.insert(regions)
.values(newRegion.data)
.onConflictDoNothing({ target: regions.name })
.onConflictDoNothing()
.returning({ name: regions.name });
if (!confirmedRegion[0]?.name) {
return {