As part of my codeship to heroku deployment hook, I'd like to run database updates/migrations before the app starts. How can I trigger an npm script or a command line script in heroku using the codeship deployment step?
I tried putting it in as part of my npm start script but it seems to have trouble connecting to the database then. e.g.
from package.json
"start": "./node_modules/.bin/knex migrate:latest && node server.js"
If you add a custom deploy script to Codeship after the Heroku deployment step, it should run after the app is running, so you'll have database access. You have access to the heroku toolkit, so you should be able to run: heroku run --app YOUR_APP_NAME -- ./node_modules/.bin/knex migrate:latest