-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
Describe the Bug
golang-migrate no longer respects safe updates within MySQL.
Steps to Reproduce
- Create a database that has
SQL_SAFE_UPDATESenabled. - Run any migration which causes the migrations table to be updated.
query := "DELETE FROM `" + m.config.MigrationsTable + "`"will be executed andgolang-migratewill error out:
Error 1175: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column in line 0: DELETE FROM
schema_migrations
Expected Behavior
I would expect golang-migrate to respect this flag by using an additional WHERE-statement (or by using TRUNCATE).
Migrate Version
github.com/golang-migrate/migrate/v4 v4.15.2
Loaded Source Drivers
iofs (so I can use go: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?
skoskav
Metadata
Metadata
Assignees
Labels
No labels