tadeumaia
tadeumaia
DTDrizzle Team
Created by tadeumaia on 10/14/2023 in #help
Does turso driver do not support sync methods?
The following was working fine with sqlite driver. function insertHealthAssociation(xmlHealthAssociation: { id: number; // Esse ID é sempre 0 no json então vou ignorar na escrita e autoincrementar acronym: string; }) { const result = db .insert(schema.healthAssociation) .values({ acronym: xmlHealthAssociation.acronym, }) .onConflictDoNothing() .returning().all(); if (result.length === 0) { // Property 'length' does not exist on type 'Promise<{ id: number; acronym: string | null; createdAt: number | null; updatedAt: number | null; }[]>'.ts(2339) const selectReturn = db .select() .from(schema.healthAssociation) .where(eq(schema.healthAssociation.acronym, xmlHealthAssociation.acronym)); return selectReturn[0].id; } return result[0].id; }
1 replies