- Ensure Everything Works Locally
- Add 'pg' as dependency
yarn add pg
or
npm install pg
- configure knexfile file for production
production: {
client: "pg",
connection: process.env.DATABASE_URL,
migrations: { directory: "./data/migrations" },
seeds: { directory: "./data/seeds" }
}
- configure dbConfig file for production
require('dotenv').config();
const knex = require("knex");
const config = require("../knexfile.js");
const environment = process.env.DB_CONNECT || "development";
module.exports = knex(config[environment]);
- Make sure everything is pushed to master
- Ensure Deployment Was Successful
-
Set any other needed ENV variables
- Check routes to ensure connection to PG DB, SHOULD get an error
-
run migrations on heroku via
npx heroku run knex migrate:latest --app your_heroku_app_name
-
run seeds on heroku via
npx heroku run knex seed:run --app your_heroku_app_name
- Check routes to ensure connection to PG DB, SHOULD NOT get an error