You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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'.
The text was updated successfully, but these errors were encountered:
So I understand better, are you saying that the the --to target is the one that should be skipped? And that's why it errors because it skips it, then fails to find the target?
@mmkal This might be an error on my part, seems typescript resolved the types a bit strangely for me in my editor leading me to believe that --to could be used with rerun: 'SKIP' which it seems it's not supposed to. I.e. I don't think this is a bug really, but maybe more of a feature request.
And no not really, we kind of want everything up until --to to be skipped it was already ran. We worked around it by simply globbing all our .sql migrations ourselves first and entering that list, up to and including --to, and then using the migrations param instead. A bit hacky but it works.
Version: 3.2.1
Storage: SequelizeStorage
Dev setup: Typescript
Reproduction:
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'
.The text was updated successfully, but these errors were encountered: