Appearance
Introduction
The Migrata CLI is a command-line tool designed to help developers safely inspect, diff, and apply schema changes to SQL databases. It streamlines the process of managing database migrations by generating human-friendly plans and SQL scripts, ensuring that changes are both fast and reliable.
It works by tracking changes to your standard SQL DDL files and turning them into actionable migration plans, similar to how Terraform manages infrastructure as code. You do not need to learn a proprietary language; just use plain SQL, and Migrata takes care of the rest.
Key Features
- Schema Inspection: Introspect live databases or SQL files to understand your current schema.
- Diff Generation: Compare two schemas (files, directories, URLs, or live databases) and generate a detailed migration plan.
- Safe Migrations: Automatically generate multi-step SQL for complex or risky changes, reducing the chance of data loss.
- Reviewable Plans: Output migration steps in a clear, human-readable format before applying changes.
- Risk Classification: Every planned migration is labeled Safe, Warning, or Destructive so you can quickly assess impact.
- Impact Analysis: See all downstream components (views, functions, etc.) that depend on entities being modified.
- Advisory Locks: Automatically acquire advisory locks during migration to prevent concurrent run conflicts. Can be disabled with
--skip-lock. - Dev-Database Validation: Spin up an ephemeral Docker database with
--dev-imageto test schema changes before applying them. - Table Partition Support: Full support for table partition diffing and migration.
- CI/CD Ready: Use
--answerto pre-supply responses to interactive prompts and--approvefor fully non-interactive automation.
Migrata CLI is ideal for teams who want confidence and control over their database evolution, whether working locally or in CI/CD pipelines.