DEV Community

Scott McKeon
Scott McKeon

Posted on

Fixing oversights: Changing a migrated column

The link below contains some important information on how to go back and change a column in your database after you have already migrated it.

https://blog.arkency.com/how-to-add-a-default-value-to-an-existing-column-in-a-rails-migration/

The central issue here is that once you migrate, how do you update the database? Let's say I have already rails db:migrate(d) my Users column, but then I realize I need to go back and add some default values.
The link above provides the methods that allow this, just do a rails generate migration in the command line and then use the code in the link above to change the migration method!

Top comments (0)