如何在node-pg-migrate中指定迁移文件夹路径?

xuo3flqw  于 2023-04-29  发布在  Node.js
关注(0)|答案(1)|浏览(128)

我使用node-pg-migrate包来控制迁移,但无法在CLI中指定要创建迁移文件的文件夹。
当我运行node-pg-migrate create my first migration --migration-dir .\src\infra\db\config\pg\migrations\时,我得到了一个错误:
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'
似乎“create”不支持指定目录,对吗?

kiayqfof

kiayqfof1#

在你的包裹里。json将脚本从"node-pg-migrate"更新为"node-pg-migrate -m './path/to/desired/folder'"
例如:

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

相关问题