javascriptnode.jstypescriptnode-pg-migrate

How to specify the migration folder path in node-pg-migrate?


I'm using the package node-pg-migrate to control my migrations, but i can't specify the folder i want to create the migration file in CLI.

When i run node-pg-migrate create my first migration --migration-dir .\src\infra\db\config\pg\migrations\ i got an error:

Error: ENOENT: no such file or directory, open 'C:\Users\PTI\Documents\projects\ArchMaster\migrations\1678477686024_my-first-migration-.\src\infra\db\config\pg\migrations\.js'

It's seens that "create" does'nt support specify the directory, is that rigth?


Solution

  • In your package.json update your script from "node-pg-migrate" to "node-pg-migrate -m './path/to/desired/folder'"

    e.g:

    "scripts": {
        "migrate": "node-pg-migrate -m './app/migrations'",
        "test": "echo \"Error: no test specified\" && exit 1"
      }