Skip to content

Running Migrations

Once you’ve created migrations, you need to run them to apply changes to your database. This guide covers everything about executing and managing migrations.

  1. Check Migration History

    • Reads which migrations have already run
    • Stored in a migrations table in your database
  2. Find Pending Migrations

    • Compares created migrations with migration history
    • Identifies which haven’t run yet
  3. Run Pending Migrations

    • Runs in timestamp order (oldest first)
    • Records completion in migration history
  4. Update Database

    • Your database schema is now updated
    • Ready to use with your models
terminal
st db:migrate

or

terminal
stratus-ts db:migrate

What it does:

  • Runs all migrations that haven’t been executed yet
  • Runs them in chronological order
  • Stops if any migration fails

Now that you can run migrations: