3

My flask application now has 20+ migrations built with flask-migrate and they all have hashed file names like: 389d9662fec7_.py

I want to double check the settings on the latest migration that I ran, but don't want to open every file to look for the correct one. I could create a new dummy migration and look at what it references as the down_revision but that seems clunky.

I'm using flask-script, flask-migrate, and flask-sqlalchemy

My question is: How can I quickly find the latest migration that I created?

davidism
  • 121,510
  • 29
  • 395
  • 339
rykener
  • 711
  • 1
  • 6
  • 16

2 Answers2

4

./manage.py db history -r current: will show the migrations in the order they will be applied. -r current: shows only the migrations since the currently applied one.

./manage.py db heads will show the most recent migration for each branch (typically there's only one branch). ./manage.py db upgrade would apply all migrations to get to the head.

Use the -v flag to get verbose output, including the full path to the migration.

davidism
  • 121,510
  • 29
  • 395
  • 339
1

You can also check in your database and the current version should be displayed in a table called alembic_version.

Joseph
  • 11
  • 1