Friday, October 19, 2012

Rename a database column in Rails using migration

There are times when you need to rename a database table's column name in Rails which was originally created by using scaffold/generate command. To do so first create a new empty migration and then add following statement in self.up
rename_column :table, :old_column, :new_column
Visit this question for detail description (with complete code) Rename a database column in a migration

No comments:

Post a Comment