piccolo icon indicating copy to clipboard operation
piccolo copied to clipboard

Using `db_column_name` when adding columns to existing tables using auto migrations

Open dantownsend opened this issue 11 months ago • 1 comments

You can explicitly specify the database column name:

class MyTable(Table):
    type_ = Varchar(db_column_name="type")

When using auto migrations to add such a column to an existing table, it seems like db_column_name isn't being used.

dantownsend avatar Mar 11 '24 19:03 dantownsend

@dantownsend I think dropping a column has db_column_name from an existing table does not work as well.

Perhaps need to set db_column_name instead of column_name. https://github.com/piccolo-orm/piccolo/blob/master/piccolo/apps/migrations/auto/migration_manager.py#L668

atkei avatar Apr 11 '24 03:04 atkei