Closed joakimbeng closed 7 years ago
Thanks for the issue. I was trying to think about how to improve this, since it really is only an issue with the fs
plugin in particular, and what I've come up with is using an internal queue for mutation. That way the async nature can still be used with the other plugins. However, I am wondering if perhaps the plugin API should be changed to an array instead so database plugins can just insert multiple entries easier. Probably not worth breaking today since it's an oddity that would only be needed with a manual log
anyway.
Because of the
Promise.all
in bothlog
andunlog
Immigration tries to log/unlog migrations in parallel when run for multiple migrations (this should be a problem in thetidy
method as well because it's built in the same way). This destroys the.migrate.json
file if used with the fs plugin, and is probably bad for other plugins as well. In my case when runninglog
for about 15 migrations only one (random) of them is stored in the.migrate.json
and the file contains malformed json (it ends in triple}
).An
Array.reduce
would fix this, in the same way as themigrate
method runs all migrations.I will try and get some time fixing this and submitting a PR for it.