miércoles 13 de febrero de 2008

DRY migrations: domains in migrations without SQLdomains in yor database

Wtih the new release 0.81 of domain-migrations plugin you can use sql-like domains in yor migrations and choose to 'inline' the column type in sql generation: you don't need support for "CREATE DOMAIN" sentence in your database engine. So, this:

create_domain :money, :numeric, :precision => 5, :scale => 2
crete_table :products do |t|
t.money :price

is fully equivalent to:

crete_table :products do |t|
t.numeric, :price, :precision => 5, :scale => 2


You don't need repeat the same column options anymore!