yerassyl
yerassyl

Reputation: 3057

Postgresql with Ruby on Rails

I want to migrate from sqlite3 to postgresql. After doing search I found that I should change my database.yml to somthing like that:

  adapter: postgresql
  encoding: unicode
  database: [insert your dev database name]
  pool: 5
  username: [insert your user name]
  password:

But I don't know what to provide in place of database, username and password. Because i don't remember creating any of them. I just created my rails app and migrations , and thats it.

Upvotes: 2

Views: 61

Answers (1)

Arivarasan L
Arivarasan L

Reputation: 9988

To configure your rails project with postgres database do the below steps. provide your database details in the database.yml file eg:

development:
  username: postgres
  database: ur-db-dev
  password: pass
  encoding: UTF8
  adapter:  postgresql
  timeout:  500
  pool:     5

add postgres gem in your Gemfile

gem 'pg'

then,

  1. Do bundle install to install postgres gem
  2. rake db:create to create your database
  3. rake db:migrate to migrate your migration files

Upvotes: 2

Related Questions