Turso Schema Database migration with drizzle-orm/libsql/migrator

hi all, having this issue with migrations using drizzle for turso schema databases (--type schema), is this somehow affected by turso running these migrations as transactions internally, and drizzle trying to run the migrations in transactions too, causing "the migration is already run within a transaction" error? 6 | rawCode; 7 | constructor(message, code, rawCode, cause) { 8 | if (code !== undefined) { 9 | message = ${code}: ${message}; 10 | } 11 | super(message, { cause }); ^ LibsqlError: SCHEMA_MIGRATION_ERROR: Schema migration error: migration is invalid: it contains transaction items (BEGIN, COMMIT, SAVEPOINT...) which are not allowed. The migration is already run within a transaction code: "SCHEMA_MIGRATION_ERROR" at new LibsqlError (/node_modules/@libsql/core/lib-esm/api.js:11:9) at mapHranaError (/node_modules/@libsql/client/lib-esm/hrana.js:257:16) at /node_modules/@libsql/client/lib-esm/http.js:85:19 1 | / Generic error produced by the Hrana client. */ 2 | export class ClientError extends Error { 3 | / @private */ 4 | constructor(message) { ^ ResponseError: Schema migration error: migration is invalid: it contains transaction items (BEGIN, COMMIT, SAVEPOINT...) which are not allowed. The migration is already run within a transaction code: "SCHEMA_MIGRATION_ERROR" at /node_modules/@libsql/hrana-client/lib-esm/errors.js:4:11
3 Replies
JoshyMcD
JoshyMcD•4w ago
@GandalfTheMopy did you ever find a solution to this? I'm hitting the same error 😦
GandalfTheMopy
GandalfTheMopyOP•4w ago
i think my issue was my previous migration was still happening, and i had to wait awhile till all the database using the specific schema has completed then only execute the migration
JoshyMcD
JoshyMcD•4w ago
Ahh okay, in that case I'll scrap my current db, start fresh and see where I get to with it Thanks 🙂
Want results from more Discord servers?
Add your server