I'm trying to switch development (and test/production) databases to PostgreSQL so I can deploy my rails app to Heroku.
Followed their directions and a railscast and looked around StackOverflow and Google for the right way to rewrite my database.yml file and do everything else, but I've been running into a lot of problems, so I was hoping someone could help me figure out what else I need to do. I'll just explain what I've tried below.
One major question is what to do with my database.yml file. A lot of sites disagree, or simply don't have any entries for pool or username or encoding (or, for that matter, the whole Production environment). Here's what I ended up with after some looking around and combining. Should this work?:
development:
adapter: postgresql
encoding: unicode
database: <appname>_development
pool: 5
username: <username>
password: <password>
test:
adapter: postgresql
database: <appname>_test
username: <username>
password: <password>
host: localhost
What is Pool? Do I need encoding? Why do so many examples have no production section in the yml file?
Per the Railscast suggestion, I homebrew installed PostgreSQL, then init'd the db, then executed this line.
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
Following another StackOverflow answer, I ensured my Postgres was in the /usr/local/bin/postgres directory, and I added this line to my .bash_profile file.
export PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
Also on the Railscast's suggestion, I installed the taps gem, and executed the following lines:
taps server sqlite://db.development.sqlite3 <username> <password>
then opened a new tab and executed:
taps pull postgresql://<username>@localhost/<appname>_development http://localhost//5000
But when I enter that, I get the following error:
Failed to connect to database:
Sequel::AdapterNotFound -> LoadError: cannot load such file -- sequel/adapters/postgresql
Sure I'm doing a bunch wrong. (For instance, should I be pulling from the sqlite3 database instead? How do I know its url?). But I have no idea how to start troubleshooting, so I figured I'd ask for help.
Thanks!