Tweet-311-Denver / tweet_311_denver_service

Backend for Tweet311Denver Turing Project
MIT License
1 stars 0 forks source link

Use Knex and configure for deployment #12

Closed ap2322 closed 4 years ago

ap2322 commented 4 years ago

PIVOT from sequelize to knex to connect to our database.

This branch is successfully deployed to Heroku. To run knex commands use heroku run. For example, to {drop,create,migrate,seed} the heroku database perform the following commands:

heroku pg:reset DATABASE 
// (confirm the reset of the db)
heroku run knex migrate:latest
heroku run knex seed:run

Locally to reset your database:

  1. get into psql in the terminal to drop the database

    psql -U postgres
    DROP DATABASE tweet_311_denver_service_dev;
    DROP DATABASE tweet_311_denver_service_test;
  2. Before exiting psql, create your dbs:

    CREATE DATABASE tweet_311_denver_service_dev;
    CREATE DATABASE tweet_311_denver_service_test;
    exit
  3. Run your knex migrations for dev (default) and test --env test in your terminal (not within psql)

    knex migrate:latest 
    knex seed:run
    knex migrate:latest --env test
    knex seed:run --env test