jackc / tern

The SQL Fan's Migrator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rollback using helm ends with an error if "last" is used

antonyc opened this issue · comments

Hi! Thanks for the great tool. We're started using tern with a k8s job that is recreated with each new helm release. That also means that a previous version of the job is created with each helm rollback.
For simplicity we run tern with "last" destination. That greatly simplifies experience.

This piece of code is causing problems with rollback.

tern/migrate/migrate.go

Lines 303 to 306 in 22a33fd

if currentVersion < 0 || int32(len(m.Migrations)) < currentVersion {
errMsg := fmt.Sprintf("current version %d is outside the valid versions of 0 to %d", currentVersion, len(m.Migrations))
return BadVersionError(errMsg)
}

I suggest having a CLI argument to turn this control off if flag is set. WDYT?

Sorry, I'm not sure I understand. The problem is last as a destination doesn't work under what conditions?