Is there a way to show the migrations already applied ?
I would like to know which migration is the last one, so I can decide whether to undo it or not.
You can use the helper method as mentioned by @mcranston18. In addition you can also pass an env
variable as well to select the database you want to query.
NODE_ENV=test ./node_modules/.bin/sequelize db:migrate:status
which will give you an output like this
Up
means that the migration has run against the current database and down means it hasn't.
The default env would be picked from your Sequelize/index.js
This data is maintained by Sequelize in a table called SequelizeMeta
. You can also query this table directly to know what was the last successful migration.