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_sourcesusing one shared migration directory, dialect and history table name. Each database keeps its own migration history and pending plan. - Multi-source
create,baseline,status,upanddown, with--parallelcontrolling 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 Nforshard_0throughshard_(N-1), referencing the correspondingSHARD_0_DSN,SHARD_1_DSN, etc. environment variables.--multialone 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 confignow defaults tomigration_config.ymlwith native YAML comments. Use--format jsonto generate strict JSON.- Configuration discovery tries
migration_config.yml,migration_config.yaml, thenmigration_config.json. An explicit--configselects only that file.
Fixed
- Report the installed Go module version in
versionandcapabilitiesforgo install ...@version, while retaining injected release build versions and thedevfallback 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_sourcesinstead of the top-leveldata_source_name. Top-levelssh_tunnelremains 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 versiongenerates 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 jsonTo 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 4Prebuilt 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