Setup hanami with postgresql

hanami web framework is a new ruby framework for developing web applications. I’ve been following the guides at hanamirb.org but I want to use postgresql as the database and rspec as the testing framework. Here are the steps I did:

hanami new bookshelf --database postgresql --test rspec
bundle install

Create a database for development and test environment.

sudo su - postgres
createuser --pwprompt username # change 'username' to your username createdb -O usernamebookshelf_hanami_development
createdb -O username bookshelf_hanami_test

Edit .development and .test environment config files

#.env_development
DATABASE_URL="postgresql://username:password@localhost/gov_catalyst_hanami_development"
#.env_test
DATABASE_URL="postgresql://username:password@localhost/gov_catalyst_hanami_test"

Prepare database.

hanami db prepare

Start developing!

Like what you read? Give Von Christian Halip a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.