-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[BUG] MYSQL driver no longer respects safe updates #864
Comments
This is still an issue in v4.16.2, is there anything that can be done so safe updates work again? |
Could this be solved by adding a LIMIT clause to the delete instead of moving back to truncate which is not transactional? |
I made a PR that should solve this issue #1070 while still keeping the DELETE. I've also created tag v4.17.0-safe in our fork which incorporates this change already. It can be used like this: |
Yes this works for me :) |
Just tried this locally and it did not actually resolve my issue:
|
Describe the Bug
golang-migrate
no longer respects safe updates within MySQL.Steps to Reproduce
SQL_SAFE_UPDATES
enabled.query := "DELETE FROM `" + m.config.MigrationsTable + "`"
will be executed andgolang-migrate
will error out:Expected Behavior
I would expect
golang-migrate
to respect this flag by using an additionalWHERE
-statement (or by usingTRUNCATE
).Migrate Version
github.com/golang-migrate/migrate/v4 v4.15.2
Loaded Source Drivers
iofs
(so I can usego:embed
)Loaded Database Drivers
mysql
Go Version
go version go1.19.3 darwin/amd64
Additional context
This does not happen in v4.15.1 as it used
TRUNCATE
(changed with #656), which is acceptable for safe updating. Might be nice if I, as a user, could select what I want to use?The text was updated successfully, but these errors were encountered: