Displaying 1 result from an estimated 1 matches for "addrailsfield".
Did you mean:
addrailsfields
2006 Jun 05
0
migration to be called inside others migrations
...to move a legacy db on a rails app. I have
a bunch of tables which need some custom modifications and the columns
updated_at to be added etc...
Now since the rails related columns will be the same for many (but not
all) tables I was thinking... can I write a Migration that sounds like
that
class AddRailsFields < ActiveRecord::Migration
def self.up(tbname)
add_column tbname, "lock_version", :integer, :default => 0
rename_column tbname, "oldtimestamp", "updated_at"
end
def self.down(tbname)
remove_column tbname, "lock_version"
rename_co...