Skip to main content

Refresh Migrations Command

The refresh:migrations command rolls back all migrations (or drops all tables) and then re-runs all migrations from scratch.

Usage

yarn hysteria refresh:migrations

Options

  • -f, --force: Drop all tables before running migrations (instead of running down migrations).
  • -m, --migration-path [path]: Path to the migrations.
  • -d, --datasource [path]: Path to a sql file (default export).
  • -t, --transactional: Runs all the pending migrations in a single transaction, this does not apply to mysql since it does not support transactions inside schema changes.

Example

# Using a sql file
yarn hysteria refresh:migrations --force -d ./database/index.ts

# Alternative with explicit connection flags
yarn hysteria refresh:migrations --force -t postgres -h localhost -d test -u root -p root

Back to: CLI Overview