Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap every SQLite query in a transaction #13

Merged
merged 2 commits into from
Feb 28, 2023

Conversation

adamziel
Copy link
Collaborator

@adamziel adamziel commented Feb 23, 2023

(Note this PR isn't targeting the main branch)

Description

This PR wraps SQLite query execution in a transaction, or in a nested transaction if one is already in progress.

Why?

Many MySQL queries require more than one SQLite query, for example ALTER TABLE ADD COLUMN col1 text, ADD COLUMN col1 text. At the moment, the first part of the ALTER query will succeed and the second one will fail – leaving the database in an undefined, broken state. This PR makes SQLite queries as atomic as their MySQL counterparts. They'll either all succeed or all fail.

cc @aristath @swissspidy

@adamziel adamziel mentioned this pull request Feb 25, 2023
Base automatically changed from sqlite-translator/use-transactions to main February 28, 2023 12:05
@aristath aristath merged commit 0ee1770 into main Feb 28, 2023
@aristath aristath deleted the sqlite-translator/use-transactions-for-real branch February 28, 2023 12:05
@batonac batonac mentioned this pull request Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants