Rollback alembic merge

I checked out an existing Flask-Restful project that Alembic uses and when I ran migrations I had to merge various puzzles. I can't figure out how this happened - I pushed myself off the desktop and reached straight for my laptop.

I was able to resolve the issue and proceed as usual.

Later, I pushed to Git and pulled the project back to my desktop. When I try to run

python manage.py db upgrade

      

I get:

sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) column "logo" of relation "despatch_details" does not exist
[SQL: 'ALTER TABLE despatch_details DROP COLUMN logo']

      

Looking at the database on my desktop computer, I can see that it is ahead of the merge point. For example, some tables that post-merge scripts try to create already exist on my desktop, but alembic_version

are halfway between the merge point and the last migration.

I tried manually editing scripts and fixing one error after another, but it just dug me deeper.

Do I need to rollback on my desktop to the merge point and then start a new one

python manage.py db upgrade

      

I can't hack it as the last thing I want is to have the same problem when I click on the stage (which is currently behind the merge point).

If I go back to my desktop and the update fails again, where exactly will I be standing?

+3


source to share





All Articles