Add a column
Ensure that the migration is run before the new code is deployed. Otherwise, nothing to do.
Remove a column
- In your
ActiveRecord
model:self.ignored_columns += %w[column_i_want_removed]
- Deploy code change
- Add migration to remove column
- Deploy migration
- Remove
self.ignored_columns
Rename a column
- Add new column
- Deploy migration
- Change code to write to both old and new column
- Deploy
- Run a backfill script which sets the new column to values of the old
- Change code to use the new column, set the old column to
self.ignored_columns
- Deploy
- Add migration to remove the old column
- Deploy migration
- Remove
self.ignored_columns