Posted By

edwinjanmoss on 10/18/07


Tagged


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

shovanjoshi
jaacob
webstic


Avoid duplicate column Error in Migration


 / Published in: Rails
 

Add "rescue nil" to migration commands that you want the migration to try but don't care if it fails. Helpful for debugging migrations and helpful when you want to modify a previous migration, let's say add a column, and you don't want the remove column in the drop block to choke your reverse migration.

  1. add_column :users, :ssn_part, :string rescue nil

Report this snippet  

You need to login to post a comment.