Undocumented Node Migrate options
Migrate is a very useful migration framework for Node. Unfortunately, its documentation is lacking in places. Here are a couple of handy options not covered by the README.
Load environment variables with dotenv
--env flag loads environment variables using
dotenv. This is particularly useful for database migrations which depend on environment-specific credentials.
migrate up --env
Ignore files and folders
Ignore specific files and folders using the
--matches flag. The pattern matching isn’t very sophisticated, so keep it simple. For example, I keep my supporting files in a “helpers” subdirectory.
migrate down --matches '!helpers'
Sign up for my newsletter
A monthly round-up of blog posts, projects, and internet oddments.