SUPPORT THE SITE WITH A CLICK

Subscribe Rss:

SUPPORT THE SITE WITH A CLICK

Monday, April 28, 2008

Rake task related to the database

db:charset Retrieves the charset for the current environment’s
database

db:collation Retrieves the collation for the current environment’s
database

db:create Create the database defined in config/database.yml for
the current RAILS_ENV

db:create:all Create all the local databases defined in
config/database.yml

db:drop Drops the database for the current RAILS_ENV

db:drop:all Drops all the local databases defined in
config/database.yml

db:reset Drops and recreates the database from db/schema.rb for
the current environment.

db:rollback Rolls the schema back to the previous version. Specify
the number of steps with STEP=n

db:version Retrieves the current schema version number


We have a far better database administration support. In the older Rails
now we would log into our databases admin consoles and create the
database manually. Now, we can do simply:
rake db:create:all
If we want to start from scratch, we can do db:drop:all. And in the
middle of development we can do db:rollback to undo the latest
migration file.

No comments :

Post a Comment