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

Run Schema changes in a transaction #1644

Open
goetzk opened this issue Nov 5, 2024 · 2 comments
Open

Run Schema changes in a transaction #1644

goetzk opened this issue Nov 5, 2024 · 2 comments

Comments

@goetzk
Copy link
Contributor

goetzk commented Nov 5, 2024

Not sure if this is a question or a feature request sorry.

It would be really good if schema upgrades (eg 196 to 197) ran in transactions. I had migration 197 fail on the first attempt (for unrelated reasons) and on the second attempt i_created_on already existed (https://github.com/collectiveaccess/providence/blob/dev/php8/support/sql/migrations/197.sql#L9).

Transactions would allow things to run in a more idempotent way, but a con is that it probably cause an increased load on DB servers during the updates.

@kehh
Copy link
Contributor

kehh commented Nov 11, 2024

Unfortunately MySQL and friends have a wonderful feature called an implicit commit on any ALTER TABLE statement, so any schema changes that actually change the schema can't reliably run inside a transaction.

See https://dev.mysql.com/doc/refman/8.4/en/implicit-commit.html for more details.

@goetzk
Copy link
Contributor Author

goetzk commented Nov 16, 2024 via email

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

No branches or pull requests

2 participants