Alembic not going back to previous migration?

Currently, I am working on this PR. A problem arose with some SQLite tests and I made changes to the latest migration file.
This is my output of alembic -c src/mailman/config/alembic.cfg history
command
On doing alembic -c src/mailman/config/alembic.cfg current -v
But when I run alembic -c src/mailman/config/alembic.cfg upgrade head
. It gives a long traceback, the main gist of which is
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) duplicate column name: bounce_info [SQL: 'ALTER TABLE address ADD COLUMN bounce_info BLOB'] (Background on this error at: >http://sqlalche.me/e/e3q8)
The whole traceback is [here[(https://gist.github.com/berserker1/6b214626042a6c976f780b33d2d12f32)
I did alembic -c src/mailman/config/alembic.cfg downgrade 2d2d0ef0828f
to ensure it has restored to the previous version but still, again the error pops up
Basically, Alembic is not able to properly downgrade and hence recognising a duplicate column when I upgrade.
Any pointer to this would be helpful.

I will explain a little bit more what I exactly did, I downgraded alembic to 2d2d0ef0828f
version, made changes to 58858f75303c
migration file and then tried to upgrade again but alembic is recognising duplicating columns which means it has not downgraded properly, can we somehow erase all changes keep till 2d2d0ef0828f
version somehow cleanly?
Pointers on this are required.

On 6/28/19 2:59 PM, Aaryan Bhagat wrote:
I will explain a little bit more what I exactly did, I downgraded alembic to
2d2d0ef0828f
version, made changes to58858f75303c
migration file and then tried to upgrade again but alembic is recognising duplicating columns which means it has not downgraded properly, can we somehow erase all changes keep till2d2d0ef0828f
version somehow cleanly?
Pointers on this are required.
It's not alembic's fault. It's sqlite which can't remove a column. You have to test for things like this. There are examples in the existing migrations such as 46e92facee7_add_serverowner_domainowner.py.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

I will explain a little bit more what I exactly did, I downgraded alembic to 2d2d0ef0828f
version, made changes to 58858f75303c
migration file and then tried to upgrade again but alembic is recognising duplicating columns which means it has not downgraded properly, can we somehow erase all changes keep till 2d2d0ef0828f
version somehow cleanly?
Pointers on this are required.

On 6/28/19 2:59 PM, Aaryan Bhagat wrote:
I will explain a little bit more what I exactly did, I downgraded alembic to
2d2d0ef0828f
version, made changes to58858f75303c
migration file and then tried to upgrade again but alembic is recognising duplicating columns which means it has not downgraded properly, can we somehow erase all changes keep till2d2d0ef0828f
version somehow cleanly?
Pointers on this are required.
It's not alembic's fault. It's sqlite which can't remove a column. You have to test for things like this. There are examples in the existing migrations such as 46e92facee7_add_serverowner_domainowner.py.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (2)
-
Aaryan Bhagat
-
Mark Sapiro