Skip to main content

How do I re-run a database migration script?

Objective: This article explains how to re-run a database migration script.

Note: Database migrations should be idempotent, therefore should be able to be run multiple times. However, re-running a database migration script should typically be for development/testing purposes only.

Prerequisites:

  • You have database access in Raven Studio.

Steps:

  1. Open Raven Studio.
  2. Open the target database.
  3. View the Singletons collection.
  4. Open the MigrationRegistry document.
  5. Remove the executed script log in the scripts array and save the document.
  6. Re-run pnpm run db:<database> or pnpm run db:all

Related Articles: