Ruby, Ruby on Rails Killer Feature: DB Migrations
I think I made a mistake at the begining of last year when I chose Python as my language of 2005. It really should have been Ruby. I have been playing with Ruby the last few days and I am falling in love. Its powerful but simple. Its way more understandable than Python or Perl and very little has to be written to do some amazingly powerful stuff. I am adding a Ruby Category on this blog. I am not too interested in building web applications with Ruby on Rails but the killer feature of Rails has to be the Database Migrations which solve the hard problem of rolling out changes to your database. As Steve shows, its as simple as this:
class AddUserTable < ActiveRecord::Migration
def self.up
create_table :users do |table|
table.column :name, :string
table.column :login, :string
table.column :password, :string, :limit => 32
table.column :email, :string
end
end
def self.down
drop_table :users
end
endMigrations not only support migrating a database from a previous version to the current version but it also supports rolling back database changes.
This absoutely rocks! Its an elegant solution to a tedious problem that takes forever to automate correctly. Here are some resources:
Ruby CentralWindows One-Click InstallerO'Reilly's new Ruby and Ruby Blogs SiteRuby on RailsRubyGarden Blog (Chad Fowler)RedHanded BlogAgile Web Development with Ruby on Rails
