Setting up a Postgres Database for Rails (but not necessarily)

Created: 2023-02-09

This is geared toward debian linux users.

Connecting to Postgres and looking around.

~/repos/chorelist$ sudo -u postgres psql
psql (14.6 (Ubuntu 14.6-0ubuntu0.22.04.1))
Type "help" for help.

postgres=#

Setting up a New User

Setting up Rails

At this point you need to set up your application so that it can connect to the database.

default: &default
  adapter: postgresql
  encoding: unicode
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  username: db_username
  password: db_password 
  timeout: 5000

development:
  <<: *default
  database: app_development
  host: localhost

test:
  <<: *default
  database: app_test
  host: localhost

# Omitting the production section as that will vary on your deployment setup.
Back