|
|
|
|
|
by julian37
1821 days ago
|
|
This might work to some extent for renaming things but doesn't for any other kind of migration I can think of: - Dropping a column doesn't work (assuming the point of dropping it is actual deletion, rather than just hiding it) - Adding a column doesn't work either - Changing a column's nullability, default value, or data type doesn't work - Doesn't help with adding or changing constraints or indexes |
|
So when dropping a column it would go like this: 1. Migration is applied. Columns is removed from the new view but remains in the backing table. 2. Migration is no longer needed. Column is removed from backing table.
This design should be extendable to cover changing data type (introduce a new column and moves values over + sync values using trigger), changing default or changing the contents of a full column.
Constraints or indices are a bit trickier, but it might work to create a new column duplicated from the old one and add constraints to that instead.