Things we did while debugging our postgresql server on Digital Ocean (documenting b/c who knows, we might need again, or others might).
We did this while going through this tutorial
by adding this to ~/.bash_profile (otherwise it creates the development db)
export RAILS_ENV=production
export RACK_ENV=production
When it was complaining about the user not being in there, we created the user (weren't getting anywhere trying to figure out how to tell it we were the one we initially created)
This gave us the ability to create the correct database
$ sudo su - postgres
$ psql
> \du -- display all users and their roles
> CREATE ROLE merlin WITH CREATEDB LOGIN PASSWORD 'footprints1406';
We still could not migrate, because one of the migrations tried to create the hstore extension. So, we had the superuser create it:
$ rake db:create
$ sudo su - postgres
$ psql
> \list -- see all databases, make sure it's there
> \connect travel_hub_production -- connect to the db we want to add the extension to
> create extension hstore; -- create the hstore extension (we can do this, we're root)
> \q
$ exit
$ rake db:migrate