Blogger.create { :name =>'Matt Aimonetti',
:location => 'San Diego, Ca',
:email => mattaimonetti AT gmail.com,
:linkedin => Matt's Linkedin page,
:recommend_me => HERE,
:contractor => true}

db_tasks or how to easily manage your db

Written by matt on May 21st, 2007

Josh knowles and Matt Heidemann from Integrum and I released few weeks a go a cool plugin called rake_tasks

The thing is that the plugin was getting too big when I started hacking the MySQL adapter and adding utf-8 support we figured out it was smarter to split the plugin and create dbtasks and svntasks

I temporarily hosted db_tasks there:

http://svn.aimonetti.net/public/plugins/db_tasks/

ruby script/plugin install http://svn.aimonetti.net/public/plugins/db_tasks/

check your Rake tasks:

  • rake db:create Creates the databases defined in your config/database.yml (unless they already exist) You can also specify the charset and collation you want your dbs to use: rake db:create CHARSET='latin1' COLLATION='latin1_bin')
  • rake db:drop Drops the database for your currenet RAILS_ENV as defined in config/database.yml
  • rake db:reset Drops, creates and then migrates the database for your current RAILS_ENV
  • rake db:shell Launches the database shell using the values defined in config/database.yml
  • rake db:charset Returns the charset of your current RAILS_ENV database
  • rake db:collation Returns the collation of your current RAILS_ENV database
  • rake db:update_connection_settings add the encoding format to each environment in the database.yml file

By default, your new databases will be utf8, you can automatically create your databases by typing:

rake db:create

or reset your databases (drop, create, migrate)

rake db:reset

Another simple plugin for lazy developers.



Comments are closed