SQL during migration contains SQL code of previous Migration -Alembic

32 Views Asked by At

When I run a new-migration, the generated sql of that migration file has the sql code of previous migration files. Due to this, the types and tables i have created in previous migration that already exists are created once again,error occurs and it fails the migration process. I run the following commands,

alembic revision -m "text"
alembic upgrade head --sql
alembic upgrade head 

I tried running the command alembic upgrade <old_version>:<new_version> --sql. It generates the sql but when running the migration command it says FAILED: Range revision not allowed.

0

There are 0 best solutions below