Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using db_column_name when adding columns to existing tables using auto migrations #945

Open
dantownsend opened this issue Mar 11, 2024 · 1 comment · May be fixed by #946
Open

Using db_column_name when adding columns to existing tables using auto migrations #945

dantownsend opened this issue Mar 11, 2024 · 1 comment · May be fixed by #946
Labels
bug Something isn't working
Projects

Comments

@dantownsend
Copy link
Member

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 dantownsend added the bug Something isn't working label Mar 11, 2024
@dantownsend dantownsend added this to Needs triage in Bugs via automation Mar 11, 2024
@dantownsend dantownsend changed the title Using db_column_name with auto migrations Using db_column_name when adding columns to existing tables using auto migrations Mar 11, 2024
@atkei
Copy link

atkei commented Apr 11, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Bugs
Needs triage
2 participants