DT
Drizzle Team•3mo ago
iska

syntax atomic transaction d1 not working

getting [ERROR] To execute a transaction, please use the state.storage.transaction() API instead of the SQL BEGIN TRANSACTION or SAVEPOINT statements. The JavaScript API is safer because it will automatically roll back on exceptions, and because it interacts correctly with Durable Objects' automatic atomic write coalescing. when using return await this.db.transaction(async (tx) => { const encryptedEmail = await encrypt(email, this.env); const existingUser = await tx.select().from(users).where(eq(users.email, encryptedEmail)).get(); how to do atomic transaction while keeping drizzle orm syntax using d1 ?
1 Reply
iska
iskaOP•3mo ago
i saw this https://orm.drizzle.team/docs/batch-api seems like d1 doesnt support atomic transaction initiated by the user itself but batch-api seems to have performance drawback 😦
Drizzle ORM - Batch
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
Want results from more Discord servers?
Add your server