rubenv / sql-migrate

SQL schema migration tool for Go.
MIT License
3.18k stars 270 forks source link

Execute some down migrations #216

Closed TmLev closed 2 years ago

TmLev commented 2 years ago

I have 9 migrations (000001 ... 000009) and I need to execute down migrations with ids 000002 and 000006 and only them.

Is this possible via migrate.Exec?

Passing just these two migrations results in an error:

Unable to create migration plan because of 000001_<...>.sql: unknown migration in database

Passing all migrations and removing .Up from the good ones results in empty gorp_migrations table, which is strange.

TmLev commented 2 years ago

Okay, it is possible, but you need to use migrate.SetIgnoreUnknown(true).