yogthos/migratus
Add a function to rollback to a target migration similar to migrate-until-just-before for ups
Aperta
#200 aperta il 17 feb 2021
enhancementhelp wanted
Metriche repository
- Star
- (686 stelle)
- Metriche merge PR
- (Metriche PR in attesa)
Descrizione
Right now you can only down migrations by a specific id(s). Sometimes, I want to rollback to a specific point similar to going up to a specific point via migratus.core/migrate-until-just-before. Could the implementation be as simple as:
(defn rollback-until-just-after
[config migration-id]
(with-store [store (proto/make-store config)]
(->> (uncompleted-migrations config store)
(map proto/id)
distinct
sort
reverse
(take-while #(> % migration-id))
(apply down config))))
Does this make sense?