Skip to content

v1.7.0 ​

Run the same migration directory across multiple databases with bounded concurrency. Generate commented YAML configurations for numbered shards, shared SSH settings and proxies directly from the CLI.

Added ​

  • Named data_sources using one shared migration directory, dialect and history table name. Each database keeps its own migration history and pending plan.
  • Multi-source create, baseline, status, up and down, with --parallel controlling concurrency (default 8; use 1 for sequential execution). A source failure does not stop healthy sources; all results are collected and any failure or cancellation produces a nonzero exit code.
  • Sorted per-source results, grouped dry-run plans, source-labelled stderr logs and a JSON result array for multi-source status. Single-source status JSON retains its existing shape.
  • Shared SSH/proxy configuration defaults with optional whole-object overrides per source. Each task owns and closes its database connection and SSH transport.
  • new config --multi --shards N for shard_0 through shard_(N-1), referencing the corresponding SHARD_0_DSN, SHARD_1_DSN, etc. environment variables. --multi alone generates two shards.
  • Initialization flags for SSH agent, private-key and password authentication, SOCKS5/HTTP proxies, and explicit YAML/JSON output. Generated YAML includes configuration comments; initialization does not resolve credentials or connect to databases.

Changed ​

  • new config now defaults to migration_config.yml with native YAML comments. Use --format json to generate strict JSON.
  • Configuration discovery tries migration_config.yml, migration_config.yaml, then migration_config.json. An explicit --config selects only that file.

Fixed ​

  • Report the installed Go module version in version and capabilities for go install ...@version, while retaining injected release build versions and the dev fallback for local builds.
  • Display a documentation website favicon with the correct Pages base path on every language page.

Upgrade notes ​

  • Existing single-source JSON configurations remain supported. When several default configuration files exist, the highest-priority YAML file wins; parsing or validation errors do not fall back to another file. Remove unused configurations or select the intended file with --config.
  • Multi-source configurations use data_sources instead of the top-level data_source_name. Top-level ssh_tunnel remains a shared configuration default; a source's non-null SSH object replaces that whole default object.
  • Each source must identify an independent database. There is no distributed transaction or automatic rollback of successful databases when another fails. After inspecting failed database state, rerun to apply its missing migrations; already-applied migrations are skipped using each database's own history.
  • Parent cancellation stops dispatching new tasks, cancels active work and waits for local cleanup. Cancellation is not a cross-database rollback guarantee; inspect database state after interrupted or nontransactional operations.
  • new version generates one file using shared settings, without opening database connections or requiring source credentials. The public Go migration API and existing dialect transaction limits remain unchanged.

Install ​

bash
go install github.com/exc-works/migrate/cmd/migrate@v1.7.0
migrate version
migrate capabilities --output json

To initialize four shards sharing SSH and proxy settings:

bash
migrate new config shards.yml --multi --shards 4 --ssh-tunnel --proxy socks5
# Edit the configuration and set its referenced environment variables first.
migrate --config shards.yml up --parallel 4

Prebuilt binaries cover Linux arm64/x64/x86, macOS arm64/amd64, and Windows arm64/x64/x86. Verify downloads against checksums.txt; migration-api.d.ts provides editor declarations. Script execution requires no Node.js runtime.

中文文档 · English documentation · Changelog · Changes since v1.6.0