Reputation: 904
I'm new to Ruby on Rails and postgreSQL and had a question. Does the database.yml file get compiled when you run bundle install
on a Gemfile? Initially my gemfile had sqlite3, but I changed it to pg and tried to run bundle install
again to recompile the database.yml file, but the file still says it's using SQLite.
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
I want the adapter to be switched to postgresql
and I believe some other fields should be switched when using pg, but I'm unsure. Can anyone clarify this for me, thank you.
Upvotes: 1
Views: 523
Reputation: 944
you need to replace too your the adapter value in your config/database.yml
When you run bundle install
it will install the gems declared in your Gemfile
, but you must manually setup you database configuration. Bundle don't compile your anything on your application except the Gemfile.lock
where are declared the gems versions.
Something like:
development:
adapter: postgresql
encoding: unicode
database: myapp_development
host: localhost
password: password # if you need a password
test:
adapter: postgresql
encoding: unicode
database: myapp_test
host: localhost
password: password # if you need a password
production:
adapter: postgresql
encoding: unicode
database: myapp_production
host: localhost
password: password # probably you will need a password
Upvotes: 1
Reputation: 1226
No, database.yml
is not recompiled automatically. When you change the gem in Gemfile
, you need to also change the file:
development:
adapter: postgresql
database: dbname
username: user
password: password
encoding: unicode
Upvotes: 1