Recently I realized that none of my database columns have default values. If an object is instantiated and then saved, it might have nil values for any fields that aren't filled out.
I can make it so that I explicitly initialize these values, but then I've got some places where two controllers are creating the same object, but I didn't think of moving that code into a separate module.
I can also choose to update my migrations to specify default values, which seems cleaner.
I've decided to go with migrations. It is not a good idea to edit old migrations, so I'm creating a new migration and specifying that I want to change certain columns.
Looking at how I should change columns, I have determined that I will use this
def change
change_column :products, :size, :default => 0
end
Will this modify existing records that currently have nil set for those records?