Alembic - Remove legacy table

428 views Asked by At

I am junior dev, I am new at a project. I have to delete a legacy table.

I found it in a migration (created with Alembic):

import sqlalchemy as sa
from alembic import op


def upgrade():
    op.create_table(
        'customer_data',
        # Columns
        sa.Column('customer_id', UUID(as_uuid=True), nullable=False, primary_key=True),
        sa.Column('name', sa.String(), nullable=False),
   )

def downgrade():
    op.drop_table('customer_data')

What should I do to drop this table? Should I remove this code from the migration, remote the migration file, or create a new migration where the upgrade performs the drop table? If the last option is correct, the downgrade should do the creation?

Can I create the migration manually or I need to execute something in the command line?

0

There are 0 answers