1

I would like to list all migrations and the db status (whether a migration has been applied or not).

I'm looking for an equivalent of rails rake db:migrate:status.

example output from rake db:migrate:status:

database: dev

 Status   Migration ID    Migration Name
--------------------------------------------------
   up     20180108162849  Add user table
   up     20180110135954  Add article table
  down    20180130152036  Add index to user
Tewfik
  • 176
  • 2
  • 15

1 Answers1

5

You can list all steps, and mark the current revision, by running flask db history.

  • Add the -i / --indicate-current switch to mark the 'current' state of the database
  • Use -v / --verbose to add information like the full path for the migration script and the script header.
$ flask db history --help
Usage: flask db history [OPTIONS]

  List changeset scripts in chronological order.

Options:
  -d, --directory TEXT    migration script directory (default is "migrations")
  -r, --rev-range TEXT    Specify a revision range; format is [start]:[end]
  -v, --verbose           Use more verbose output
  -i, --indicate-current  Indicate current version (Alembic 0.9.9 or greater
                          is required)
  --help                  Show this message and exit.
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343