feat(medusa-cli): Allow to revert migrations from the CLI (#1353)

This commit is contained in:
Adrien de Peretti
2022-06-13 14:15:09 +02:00
committed by GitHub
parent b478b10438
commit 012513b6a1
2 changed files with 7 additions and 2 deletions
+5
View File
@@ -27,6 +27,11 @@ const t = async function({ directory }) {
await connection.close()
Logger.info("Migrations completed.")
process.exit()
} else if (args[0] === "revert") {
await connection.undoLastMigration({ transaction: "all" })
await connection.close()
Logger.info("Migrations reverted.")
process.exit()
} else if (args[0] === "show") {
const unapplied = await connection.showMigrations()
await connection.close()