Adds a command line parameter to set the migrationsDir property.
Imagine a program which generates two types of migration scripts, 1) for schemas, and also 2) to insert test data. Initially, I was putting the two types in a single directory, but I ran into a problem in that the schema scripts need to be applied before the insert-test-datas, otherwise you may lose test data. My solution was to enforce the logic of "schemas-before-test-data" in the program, by creating a directory for each type of migration, and then calling the schemas to be migrate-mongo up'd first, and then the test-datas.
However, the directory which migration scripts are read from/written to is determined by the migrationDirs property in the migrate-mongo-config.js file. So to output to/read from the individual type directories, I would need to edit this file to refer to one or the other before calling migrate-mongo.
It was easier modify migrate-mongo to accept a command line parameter, than to deal with programatically editing via awk/sed, the config file.
Adds a command line parameter to set the
migrationsDir
property.Imagine a program which generates two types of migration scripts, 1) for schemas, and also 2) to insert test data. Initially, I was putting the two types in a single directory, but I ran into a problem in that the schema scripts need to be applied before the insert-test-datas, otherwise you may lose test data. My solution was to enforce the logic of "schemas-before-test-data" in the program, by creating a directory for each type of migration, and then calling the schemas to be
migrate-mongo up
'd first, and then the test-datas.However, the directory which migration scripts are read from/written to is determined by the
migrationDirs
property in themigrate-mongo-config.js
file. So to output to/read from the individual type directories, I would need to edit this file to refer to one or the other before calling migrate-mongo.It was easier modify migrate-mongo to accept a command line parameter, than to deal with programatically editing via awk/sed, the config file.
Checklist
npm test
passes and has 100% coverage