What is the database.yml file?
database.yml fileENV['DATABASE_URL']config/database.ymldevelopment:
adapter: postgresql
database: blog_development
pool: 5
blog_development using the postgresql adapterdevelopment: environment used on your local computer as you code and interact with the
databasetest: used when running automated testproduction: used when your app is deployed for the world to use.development:
url: postgresql://localhost/blog_development?pool=5
erb tagsrails new demo_app database=mysql to use a MYSQL DB.database.yml file:development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
sudo -u postgres creatuser rubyuser -s
rubyuser is the name of the user, can be any namesudo -u postgres psql
postgres=# \password rubyuser
postgres=# CREATE DATABASE name_of_database OWNER rubyuser;
CREATE DATABASE
name_development, name_test, name_productionCTRL-D will terminate postgres **database.yml filedefault: &default
adapter: postgresql
encoding: unicode
development:
<<: *default
database: name_development
username: rubyuser
password: <password entered in the terminal>
test:
<<: *default
database: name_test
username: rubyuser
password: <..>
production:
<<: *default
database: name_production
username: rubyuser
password: <..>