This is a note to myself and those who are interested.
GERRG
I use Heroku for hosting my Ruby on Rails applications. Problem is, Heroku doesn’t support SQlite databases.
If you’ve ever tried to run rails db:migrate
to create a postgesSQL database WITHOUT first setting up the databases manually, you will recognize this error:
rails aborted!
ActiveRecord::NoDatabaseError: FATAL: database "spitter_development" does not exist
Setup a PostgreSQL database
Run the following command.
psql
If you get this error, your package manager did not setup your user account up properly.
createdb: database creation failed: ERROR: source database "template1" is being accessed by other users
Run the createdb
command.
$ createdb
$ psql
psql (10.10 (Ubuntu 10.10-0ubuntu0.18.04.1))
Type "help" for help.
Create the databases
Once you are in psql, run \list
to see all the databases on your server (service)

Now run the CREATE DATABASE command followed by the name of your rails applications and finally suffixed with _development
and _test
respectively.
Dont forget the semi-colons! ( ; )
CREATE DATABASE yourapp_development;
CREATE DATABASE yourapp_test;
Run the \list
command again to confirm your databases were added correctly.

3 replies on “How to create PostgreSQL database for Ruby On Rails”
[…] If psql didn’t work or needs to be setup, I wrote a short post about getting setup with PostgreSQL. […]
erectile aids
best ed pills
for erectile dysfunction
do erectile pills permanently increase size
problems with erectile dysfunction
dysfunction
can erectile dysfunction happen suddenly