Forums

Migration failed when entering a new table

Hi team, I am finishing the tutorial https://blog.pythonanywhere.com/158/ everything is fine except for the migrations that did not accept the users database that we included at the end of the tutorial, because when launching the script "flask db migrate" it did not recognize any changes. When consulting the tables in the MySQL console, the users table does not appear, only the comments table appears:

(flask-tutorial) 09:26 ~ / mysite (master) $ flask db migrate

INFO [alembic.runtime.migration] Context impl MySQLImpl. INFO [alembic.runtime.migration] Will assume non-transactional DDL. ERROR [flask_migrate] Error: Can't locate revision identified by '050a1f903898'

(flask-tutorial) 09:38 ~ / mysite (master) $ flask db upgrade

INFO [alembic.runtime.migration] Context impl MySQLImpl. INFO [alembic.runtime.migration] Will assume non-transactional DDL. ERROR [flask_migrate] Error: Can't locate revision identified by '050a1f903898'

I will appreciate any guidance :)

It sounds like you have broken your migrations in some way. The easiest way to recover from that (since you've just completed the tutorial) would be to delete your existing database and re-create it from scratch.

The golden rule that restarting works again! I lost this point, but now I have everything working perfectly again, thanks for redirecting me :)

@pysoft Glad to hear that it works for you!