yogthos / migratus

MIGRATE ALL THE THINGS!
642 stars 93 forks source link

Update `migratus.core/rollback` behavior to roll back last applied migration when no arguments are provided #199

Closed S4G4R closed 1 year ago

S4G4R commented 3 years ago

The documentation states : Run 'down' for the last migration that was run.

Which would mean it should roll back the last migration that was applied.

Instead, I find that it rolls back according to the id (migration creation timestamp).

Reproduction Steps :

  1. Create 3 migrations one after the other (say A -> B -> C)
  2. Apply migration A first, followed by C and then B
  3. Run migratus.core/rollback

Result :

yogthos commented 3 years ago

Yeah, the documentation is misleading there. I'll update the docs, but I'd be open to switching the behavior to running the last applied migration. Would you be up for doing a PR for this by any chance? :)

S4G4R commented 3 years ago

Still relatively new to Clojure, but I will give it a go! :)

yogthos commented 3 years ago

Sounds like a plan, and I'll try assist time permitting. :)