Thursday, 19 April 2012

Migrating to PostgreSQL

Resources

terminal
psql --version
brew install postgresql
initdb /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
which psql
rails new blog -d postgresql
rake db:create:all
rails g scaffold article name content:text
rake db:migrate
psql blog_development
rails db
gem install taps
taps
taps server sqlite://db/development.sqlite3 rbates secret
taps pull postgres://rbates@localhost/store_development http://rbates:secret@localhost:5000
rails db
select * from articles;
\d
\d articles
\?
\h
\h select
\q
config/database.yml
development:
  adapter: postgresql
  encoding: unicode
  database: blog_development
  pool: 5
  username: rbates
  password:

test:
  adapter: postgresql
  encoding: unicode
  database: blog_test
  pool: 5
  username: rbates
  password:
Gemfile
gem "pg"


http://railscasts.com/episodes/342-migrating-to-postgresql?autoplay=true



psql --version
brew install postgresql
initdb /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
which psql
rails new blog -d postgresql
rake db:create:all
rails g scaffold article name content:text
rake db:migrate
psql blog_development
rails db
gem install taps
taps
taps server sqlite://db/development.sqlite3 rbates secret
taps pull postgres://rbates@localhost/store_development http://rbates:secret@localhost:5000

Commands used in database console

select * from articles;
\d
\d articles
\?
\h
\h select
\q

No comments:

Post a Comment