0

I ran

flask db upgrade

and received the error

VARCHAR requires a length on dialect mysql

So I corrected my VARCHAR by adding the length like this

username = db.Column(db.VARCHAR(256))

Then I ran

flask db migrate

and get the error

Target database is not up to date.

Now I'm stuck. I'm in a catch-22. I cannot migrate to the database with VARCHAR(256) because my database is not up-to-date. I cannot make my database up-to-date because the migration for VARCHAR (without the '256') is not valid.

What do I do?

Jason
  • 11,709
  • 9
  • 66
  • 82

1 Answers1

0

Delete the last migration file you generated (make sure the last file you got matches migration version in alembic db table). Then modify your model and generate a new migration.

dmitrybelyakov
  • 3,709
  • 2
  • 22
  • 26