tursodatabase / tursodatabase/libsql
Turso -schema DBs don't work with Goose migrations
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 17.2k
- Forks
- 531
- Avg merge
- 1h 12m
- Merged PRs (30d)
- 1
Description
Description
When attempting to migrate a Turso schema database with Goose, the following error occurs:
2024/05/10 11:47:00 goose run: failed to execute SQL: BEGIN
error code 500: Internal Error: migration error: Connection left in transaction state
From talking to Turso maintainer @avinassh in the Discord, this fails because Goose attempts to run migrations in a transaction, which the Turso schema DBs do not accept. I then attempted to migrate without Goose transactions as documented here:
https://pressly.github.io/goose/blog/2022/overview-sql-file/#migrations-outside-transaction
This returns with the same error as before.
Suspected Problem:
Goose keeps track of migrations in a migrations table inside of a DB. It's believed that this table creation and insertion is likely running within a transaction and it causing this problem.
Link to troubleshooting Discord Thread: https://discord.com/channels/933071162680958986/1229116060859502716
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Goose migration against a Turso schema database, first with transactions and then using the documented migrations-outside-transaction mode. Inspect the migration table creation and insertion path described in the report. Done means Goose can apply migrations to the schema database without the BEGIN or connection-left-in-transaction errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sqlite
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100