Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes part of #87.
It doesn't seem to me like anything special needs to be done to support DDL transactions for SQLite. The tests were copied from Ecto SQL and seem to pass with no issue.
For the other part of the issue, locking to prevent concurrent migrations, I don't think anything can be done as is. Ecto requires a separate transaction to hold the lock, independent of the transaction used to perform the migration. This is to allow users the ability to lock even if their migration command cannot be run inside of a transaction.
From what I can tell this is not compatible with how locks work in SQLite. It seems the same transaction has to hold the lock and do the writing. There's no mutually exclusive lock that can be held that will allow a subsequent transaction to perform a DDL statement, from what I can see.
I don't think it's completely hopeless. But I just have to figure out a good proposal for Ecto for an option to allow everything to be in one transaction.