在heroku buildpack期间运行knex迁移

Jea*_*ent 5 heroku buildpack knex.js

我正在使用流星构建包来部署我的流星应用程序。

我希望能够knex在构建包安装结束时运行迁移。

我分叉了 buildpack,在extra目录中添加了一个 shell 脚本(如 README 中所述),其中包含:cd .knex && knex migrate:latest --env staging

.knex不幸的是, buildpack 当前目录中没有任何目录。

ls -a在 heroku buildpack 期间运行以显示当前目录的内容,但没有目录.knex

remote: .
remote: ..
remote: app
remote: assets
remote: boot.js
remote: boot-utils.js
remote: config.json
remote: mini-files.js
remote: node_modules
remote: npm
remote: npm-shrinkwrap.json
remote: package.json
remote: packages
remote: program.json
remote: shell-server.js
Run Code Online (Sandbox Code Playgroud)

有什么建议么?

Ian*_*nes 4

如果您有一个迁移文件夹,最初是在 CLI 中使用以下命令创建的:knex migrate:make migration_name那么您可以使用以下命令在应用程序本身内触发迁移到最新版本:knex.migrate.latest([config])按照文档:http ://knexjs.org/#Migrations-latest

配置应该按照 a knexfile.js,我在这里遵循了一个示例以供参考: http: //www.dancorman.com/knex-your-sql-best-friend/