-
-
Notifications
You must be signed in to change notification settings - Fork 163
Description
Version: 3.2.1
Storage: SequelizeStorage
Dev setup: Typescript
Reproduction:
- Run migrations using .sql files first
- Rerun using 'to' to run to a specific migration, with rerun set to SKIP
Expected:
In this case it is expected that it would skip any migrations that have already been run.
Actual:
Migration fails with 'Couldn't find migration' Error because pending migrations will not include migrations found in SequelizeStorage making the rerun flag redundant and the behavior a bit broken.
It appears that the rerun flag is only applicable when 'migrations' are passed to up, not when 'to' is used.
We use AWS CustomResources to control migrations in our environment and that means we create the CustomResource with an up and down migration set and this causes them to fail if we for some reason need to rerun the underlying AWS Lambda with the same parameters. To solve this we need to be able to skip any migration that has already been run, instead of having it throw this error. Not sure about the approach here as rerun and to in this context seems to more mean that it would then only be that migration that would be skipped if it was already ran.
I guess a workaround would be to simple load the glob we use, sort it, and then slice at the 'to' index and run those migrations with rerun: 'SKIP'.