1

Is there any way to store current revision number in the db? I mean, when I generate migration and upgrade head, how I can insert this revision number in the db, and check the table for this revision number in next time, when I will do a migration.

snakecharmerb
  • 47,570
  • 11
  • 100
  • 153
MrOldSir
  • 616
  • 3
  • 9
  • 28

1 Answers1

6

The current HEAD is automatically stored in the version_number column in the alembic_version table in your database. You can retrieve it with this query:

SELECT version_num FROM alembic_version;
snakecharmerb
  • 47,570
  • 11
  • 100
  • 153