You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Renaming a column using the experimental column override should produce a rename column statement #4635
When an existing table model receives the experimental column key to override the name of the column in the database, the migration system produces ADD/REMOVE entries instead of RENAME. This largely defeats the purpose of using the key to rename columns for already existing tables.
Proposal
If the model field still has the same type and received a column override, the migration system should generate a rename statement instead of dropping and re-creating the table.
Use Case
A developer wants to change the field of a model without loosing data on the database. Then they could do:
Override the column name to the new name of the field - while keeping the field name unchanged.
Generate the model.
Create a migration.
Change the name of the field to the new name, removing the column override.
Generate the model.
Since on steps 4-5 the table definition will not change (same columns with same types), no migration will be generated and the model field will be safely renamed with no data loss.
Activity