Problem:
Automatically track which schema change has been made to a database.Make it easy to recreate another database with the same schema.
Requirements:
bsf.jar (from jruby binary download)
jruby-complete jar
jdbc jar
activerecord gem
activerecord-jdbc-adapter gem
activerecord-jdbc-adapter gem
Resources:
http://www.ics.muni.cz/~makub/ruby/#c2
Steps:
install jruby
jruby -S gem install --no-rdoc --no-ri activerecord
jruby -S gem install --no-rdoc --no-ri activerecord-jdbc-adapter
jruby -S gem install --no-rdoc --no-ri activerecord-jdbc-adapter
See some code at http://github.com/shenie/base_java_project/tree/master
Known issues:
The jruby-complete jar contains rubygems and you can package up the other gems (above) into the jruby-complete jar and distribute it (check it into vcs) that way.
Another way is to set GEM_PATH env variable to the location of the jruby gem directory.
e.g. /Users/andy/dev/tools/jruby/lib/ruby/gems/1.8
At the moment, you need to set GEM_PATH to be the jruby gem directory, which means each machine will require jruby to be installed plus the gems used.
It would be more ideal if we can just repackage jruby-complete jar with the additional gems to make deployment easier.
Update: Thanks to Nick's blog, you no longer have to set GEM_PATH to get the gems required included by the base application.
Update: Thanks to Nick's blog, you no longer have to set GEM_PATH to get the gems required included by the base application.
1 comment:
Yeah; ActiveRecord is incredibly useful in that it allows the developers to:
1. move the database state up or down to any specific revision by simply running the migration scripts in a sequential revision order.
2. also quickly create fixtures data for testing the functionality they work on, thus promoting Test-Driven development.
Recently, in a couple of projects I used ActiveRecord Migrations to manage database setup and migrations. You can find a walk-though the steps to follow in order to get a set of ActiveRecord migrations working on a Ubuntu-9.0.4 desktop at Using ActiveRecord for Database Setup and Migration: A How-to
Post a Comment