OS Manuals

/usr/bin/migrate

CLI and Golang library for database migrations.

From migrate 4.20.1-r9 (os), captured 2026-11-08 by running migrate --help (exit 0). permalink

Also provided by 3 other package versions
Usage: migrate OPTIONS COMMAND [arg...]
       migrate [ -version | -help ]

Options:
  -source          Location of the migrations (driver://url)
  -path            Shorthand for -source=file://path
  -database        Run migrations against this database (driver://url)
  -prefetch N      Number of migrations to load in advance before executing (default 10)
  -lock-timeout N  Allow N seconds to acquire database lock (default 15)
  -verbose         Print verbose logging
  -version         Print version
  -help            Print usage

Commands:
  create [-ext E] [-dir D] [-seq] [-digits N] [-format] [-tz] NAME
	   Create a set of timestamped up/down migrations titled NAME, in directory D with extension E.
	   Use -seq option to generate sequential up/down migrations with N digits.
	   Use -format option to specify a Go time format string. Note: migrations with the same time cause "duplicate migration version" error.
           Use -tz option to specify the timezone that will be used when generating non-sequential migrations (defaults: UTC).

  goto V       Migrate to version V
  up [N]       Apply all or N up migrations
  down [N] [-all]    Apply all or N down migrations
	Use -all to apply all down migrations
  drop [-f]    Drop everything inside database
	Use -f to bypass confirmation
  force V      Set version V but don't run migration (ignores dirty state)
  version      Print current migration version

Source drivers: file, github, github-ee
Database drivers: redshift, stub, cassandra, cockroach, postgresql, mongodb, mongodb+srv, sqlserver, clickhouse, ysql, firebirdsql, neo4j, crdb-postgres, pgx, pgx4, postgres, firebird, rqlite, mysql, pgx5, cockroachdb, yugabyte, yugabytedb, spanner
Options (8)
OptionDescriptionSource
-sourceLocation of the migrations (driver://url)help
-pathShorthand for -source=file://pathhelp
-databaseRun migrations against this database (driver://url)help
-prefetch NNumber of migrations to load in advance before executing (default 10)help
-lock-timeout NAllow N seconds to acquire database lock (default 15)help
-verbosePrint verbose logginghelp
-versionPrint versionhelp
-helpPrint usagehelp

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.