Skip to content

Specify column position for add column in batch mode #640

@ms32035

Description

@ms32035

I'd like to hear your opinion on possibility of setting the position of a column added in a batch migration (something like FIRST or AFTER <COLUMN> in mysql). It could work through an extra parameter in batch add_column

with op.batch_alter_table("some_table") as batch_op:
    batch_op.add_column(Column('foo', Integer), before_column="bar")

My initial estimate is that changes would be required here: https://github.com/sqlalchemy/alembic/blob/master/alembic/operations/batch.py#L374 and in OrderedDict in sqlalchemy to support inserts

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions