Sign inSign up

pt9912/d-migrate

By pt9912

Updated 6 days ago

DB-agnostic CLI for schema migration and data management - PostgreSQL, MySQL, MSSQL, Oracle, SQLite

Image
Developer tools
Databases & storage
0

1.6K

pt9912/d-migrate repository overview

d-migrate

Database-agnostic tool for schema migration and data management — usable as a CLI and as an MCP server. Define your schema once in a neutral YAML format, then validate, compare, generate DDL and run live diff-based migrations against PostgreSQL, MySQL, SQLite, SQL Server and Oracle. Also covers reverse engineering, streaming data export/import/transfer and export to Flyway, Liquibase, Django and Knex.

This repository is a mirror. The primary registry is GitHub Container Registry — ghcr.io/pt9912/d-migrate. Identical images are pushed to both (same build, same digest); Docker Hub exists so docker pull works without a GHCR login.

Supported tags

TagContents
<version>JVM image (Eclipse Temurin 21 JRE on Ubuntu Noble)
<version>-nativeGraalVM native binary, no JVM — smaller image, starts in milliseconds instead of a few hundred
latestMost recent stable release. Prereleases never move it.

See the Tags tab for everything published here. The examples below use 1.7.1 — the most recent release at the time this page was updated.

If you don't see a latest tag: this mirror started with a prerelease, and prereleases deliberately never move latest, so it only appears once a stable release is published here. Until then docker pull pt9912/d-migrate without an explicit tag will fail — use ghcr.io/pt9912/d-migrate:latest for a stable image. Either way, pin an explicit version in CI rather than tracking latest.

Quick start

The entrypoint is the d-migrate CLI itself, so arguments go straight after the image name. The default command is --help.

# Validate a schema
docker run --rm -v "$(pwd):/work" pt9912/d-migrate:1.7.1 \
  schema validate --source /work/schema.yaml

# Generate DDL for a target dialect
docker run --rm -v "$(pwd):/work" pt9912/d-migrate:1.7.1 \
  schema generate --source /work/schema.yaml --target postgresql

# Compare two schema files
docker run --rm -v "$(pwd):/work" pt9912/d-migrate:1.7.1 \
  schema compare --source file:/work/schema.yaml --target file:/work/schema-new.yaml

# Database-to-database data transfer
docker run --rm -v "$(pwd):/work" pt9912/d-migrate:1.7.1 \
  data transfer --source sourcedb --target targetdb --tables users,orders

The native variant is a drop-in replacement — same entrypoint, same flags, same mounts:

docker run --rm -v "$(pwd):/work" pt9912/d-migrate:1.7.1-native \
  schema validate --source /work/schema.yaml

Writing files: run as your own user

The image runs as a non-root user (uid 10001) and its working directory and volume is /work. Read-only commands (validate, compare, generate to stdout) work as shown above.

Commands that write into a bind-mounted host directoryschema reverse --output, generate to a file, file-target data transfer — need the mount to be writable by the container user. Add --user so output lands with your host ownership:

docker run --rm --user "$(id -u):$(id -g)" -v "$(pwd):/work" \
  pt9912/d-migrate:1.7.1 \
  schema reverse --source mydb --output /work/reverse.yaml

Connecting to databases

Connections are passed as URLs or as named connections from a config file. Mount the config alongside your work directory and point --config at it:

docker run --rm -v "$(pwd):/work" pt9912/d-migrate:1.7.1 \
  --config /work/.d-migrate.yaml \
  schema reverse --source mydb --output /work/reverse.yaml

Credentials should not be baked into the config — d-migrate resolves them from environment variables (D_MIGRATE_DB_PASSWORD), a credentialRef (env:, file:, keychain:), or an encrypted credential store. See the connection configuration spec.

When reaching a database on the Docker host from inside the container, use a user-defined network and container names rather than localhost — inside the container, localhost is the container itself.

What's in the image

  • JVM image: eclipse-temurin:21-jre-noble; the CLI is installed under /opt/d-migrate and is on PATH.
  • Native image: ubuntu:24.04 with the GraalVM-built binary at /usr/local/bin/d-migrate — no JRE.
  • Both include mod_spatialite, loaded only when a SQLite connection requests it via ?spatialite=true.
  • Both run as uid 10001, with /work as workdir and volume.

Which artefact should I use?

This image is one of several distributions. There is also a launcher ZIP/TAR, a fat JAR, standalone native binaries for Linux and Windows, and a Homebrew formula — see the release page and the README.

Security

Vulnerability reports and the threat model: SECURITY.md.

Tag summary

Content type

Image

Digest

sha256:c886c9b85

Size

232 MB

Last updated

6 days ago

docker pull pt9912/d-migrate