Dbtasks Intro

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 db_tasks and svn_tasks

I temporarily hosted db_tasks there:

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

<code>ruby script/plugin install https://svn.aimonetti.net/public/plugins/db_tasks/
</code>

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.


205 Words

2007-05-22

comments powered by Disqus