This application can be used as a starting point for a Postgres database backed, via Sequel, application that uses Sinatra. It can be deployed to Heroku.
There are a few things you need to change for your application:
- Change
scrips/create_databases.sql
to create both your development and test databases. - Copy the
.env.example
file to.env
. - Change the
.env
file to include your database connection strings for both your development and test databases. This file is ignored by git (see .gitignore) to protect your secrets from the outside world. - Add your migrations to the
migrations
folder. Once you have one migration there, you can delete the.gitsave
file.
bundle install
- Create a database by running
psql -d postgres -f scripts/create_databases.sql
- Populate the database environment variables in the currently running terminal
by running
source .env
. - Run the migrations in the development database using
sequel -m migrations $DATABASE_URL_DEVELOPMENT
- Run the migrations in the test database using
sequel -m migrations $DATABASE_URL_TEST
rerun rackup
- running rerun will reload app when file changes are detected
- Run tests using
rspec
.
To run the migrations on heroku, run heroku run 'sequel -m migrations $DATABASE_URL'
. If you
do not have a Heroku configuration variable named DATABASE_URL, then you will need to create one.