I have a sample Table
class a(Base):
__tablename__ = 'a'
id = Column(Integer,primary_key=True)
username = Column(VARCHAR(255))
Now I made some changes to my other tables and also added unique constraint to "username" column in the table shown above.
class a(Base):
__tablename__ = 'a'
id = Column(Integer,primary_key=True)
username = Column(VARCHAR(255),unique=True) # unique key added.
I run python run.py db migrate
command and it detects all changes. No issue.
Now I run python run.py db upgrade
. This makes all schema changes in the database but fails at the unique constraint of the above mentioned table, because that table already have repeated data. Now I need to revert all the db changes to come back to my previous version ( i can't figure how to do it). Is there anyway to test if the all the upgrades run properly before commiting schema changes to database ? if not, please help me how to revert all the db changes.