A plugin to allow CJS migrations.
npm install db-migrate-plugin-es6cjs
The plugin hooks into the functionality of db-migrate itself. In this case it hooks into migrator:migration
It allow db-migrate to detect migrations with (.cjs) extensions.
When you have a node project defined as ES6 modules, you got an error when try to import .js files generated by db-migrate tool.
[ERROR] AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Must use import to load ES Module
and the solution proposed is:
Instead rename 20210102234349-Test.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /..../package.json.
but if you rename the file to .cjs as requested, the migration tool can't find, because the it search only for .js files.