- cd into clone && run npm install.
- Create a local db.
- Change knexfile.js to reflect your local db name.
- Create a heroku app && postgresql addon.
- put your heroku-postgresql url in the .env_example and rename file right away to .env.
- Run knex commands to make migrations && seeds.
- Migrate latest!
- Don't forget to migrate to heroku.
- Enjoy!
- express --git --hbs name_of_app
- cd intro_to_knex && npm i
- nam i -S pg knex
- knex init
- git init
- npm i -S dotenv
- create a .env in route directory
- echo .env >> .gitignore
- createdb name_of_app (in my opinion)
- edit the knexfile.js
- create a heroku app: heroku apps:create name_of_app
- add a db to the app: heroku addons:create heroku-postgresql
- get the URL: heroku config
- put that URL in .env
- create a folder db and file knex.js
- git remote add origin ssh_of_repo (create a repo)
- git add/commit/push to github
- add migrations: knex migrate:make migration_name
- once finished run knex migrate:latest
- for your heroku app now run:
- knex migrate:latest --env production
- seed your db: knex seed:make seed_name
- run with knex seed:run
- for your heroku app now run:
- knex seed:run --env production
- To deploy to heroku: git push heroku master.