annotated
annotated copied to clipboard
💡 Obsolete column attribute for save column drop
trafficstars
I have one database and several services are connected to it, let's say 3 of them (A, B, C). I need to drop deprecated column in one of the tables.
I can simply delete Entity property, make a migration and apply it in service A. Then the other 2 services will start throwing errors that the column is missing. In this case, I need to update them ASAP. This is not always possible.
What if we add a new property to Column obsolete/deprecated/disable/forgotten/you_name_it) ? This property:
- tells schema-builder not to render schema for this column
- tells query-builder not to build queries with this column
- tells the migrator not to generate
dropColumnfor this column
In this case, we could first mark the column as obsolete, deploy update to all services.
Second step - we can delete Entity property, create migration with dropColumn and safely apply at all services.