-
-
Notifications
You must be signed in to change notification settings - Fork 36
Description
Hi, this is to document a missing feature. I may contribute it in the future if I get to it.
In the meantime, I thought it important to document the missing feature and a potential path to implement.
Currently migrate is implemented, which will take the un-applied migrations in the supplied directory and execute them.
However, there is no way to easily revert a migration (at least that I could find quickly).
Ideally we should have a function (mito:revert-migration down-migration-file) which takes one of int, path-name, or a string which represents a path but was not initialized as that type (convenience).
The function would then check the applied migrations in the DB, and if the migration was applied, it would revert it. @fukamachi should decide whether to do this step or not, and whether to mark the DB row as reverted or just deleted, etc.
Another question for the implementor to decide is what to do if the reverted migration is not the last applied migration, since this may or may not cause issues depending on what the other more recent migrations were.
I'm mostly raising this issue. I'm not here to suggest a path forward on how to implement. I mostly want to start the discussion and make interested parties aware of this missing functionality.
Note that cl-migratum could be used in tandem with mito, and that library deals with all of these questions already. However, it does not generate the migration files themselves, which mito does. The problem is that mito asks to delete un-applied migration files which may be inconvenient if managing the actual db migrations with cl-migratum and the generation of sql migration files with mito.