bellyphantFeed

Rails migration bug?

It seems that if you do:

rename_column :accounts, :username, :user_name
change_column :accounts, :user_name, :string, { :null => false, 
    :default => "", :limit => 25 }

you get a different result to if you do:

change_column :accounts, :username, :string, { :null => false, 
    :default => "", :limit => 25 }
rename_column :accounts, :username, :user_name

(i.e. the rename happens after the column change)

It seems your change_column gets forgotten about if you do the rename afterwards. The fix: do the rename first. I don’t know how to report ruby bugs, and I can’t be bothered fixing this particular one (it has a fairly simple workaround). Just thought I’d write about it. For fun. (I can also see how this bug came about.)

Oh yeah, the Rails migration thing is pretty cool.

Simon Russell is a software developer from Canberra currently living in London.

Links

Me in other places

Photoblogs

Friends' blogs

Stuff I read

I have to check my RSS reader to finish these links...

Recently del.icio.us links >>

del.icio.us tags