Skip to content

SYSTEM Cited by 1 source

Atlas CLI

Atlas CLI (atlasgo.io) is an open-source schema-management tool from Ariga for relational databases. It treats the database schema as a file — by convention an HCL document — and reconciles the live database against that file by computing a diff and issuing the necessary DDL. The tool is engine-aware but vendor-agnostic: it speaks the MySQL / Postgres / MariaDB / SQLite / SQL Server / ClickHouse wire protocols directly and is not tied to any particular managed- database vendor.

Primitives

  • atlas schema inspect — introspect a live database and emit an HCL file describing the current schema (tables, columns, constraints, indexes, charset, collation). Bootstraps an Atlas workflow from an existing database without rewriting the schema.
  • atlas schema apply — re-inspect the live database, compare it against the supplied HCL file, print the imperative DDL diff ("Planned Changes: …"), prompt Apply / Abort, then execute the DDL. Supports --auto-approve for CI/CD.
  • atlas migrate — alternative versioned-migration mode (not covered in the 2022 PlanetScale post) where Atlas emits migration files on diff rather than applying directly — a bridge to teams that prefer file-per-version ceremony (Flyway / Liquibase / ActiveRecord) over pure declarative reconciliation.

Schema DSL

  • HCL (HashiCorp Configuration Language) is the default — same DSL family as Terraform, which makes Atlas ergonomically familiar to teams already using Terraform for infrastructure. JSON is supported as a machine-readable alternative.
  • Column attributes encoded include type, nullability, default, auto-increment, character set, collation, and constraints. Primary keys are declared via a dedicated primary_key block.
  • Schema-level attributes include charset + collation defaults; the emitted HCL in the 2022 worked example pairs utf8mb4 + utf8mb4_0900_ai_ci (MySQL 8 defaults — see concepts/utf8mb4-vs-utf8).

Connection model

Atlas connects via a standard wire-protocol URL — e.g. mysql://<user>:<pass>@<host>/<db>?tls=true for a TLS-enforced MySQL endpoint such as PlanetScale. The URL is the single integration point with any managed- database vendor; Atlas does not require special vendor-side cooperation.

Vendor compatibility trade-offs

Atlas's approach (issue DDL directly over the MySQL protocol to reconcile the live database against the HCL file) conflicts with vendor-managed schema- change pipelines that expect schema changes to flow through the vendor's own UI / API. Canonical example: PlanetScale's safe migrations feature blocks direct DDL against production, routing schema changes through PlanetScale's deploy-request + branching workflow instead. To use Atlas against a PlanetScale database the operator must disable safe migrations (Source: [[sources/2026-04-21-planetscale-declarative-mysql- schemas-with-atlas-cli]]). Declarative tools and vendor-managed schema-change pipelines are rivals, not complements — the customer picks one ceremony.

Role in the patterns/declarative-schema-management pattern

Atlas is the canonical reference implementation of the declarative-schema-management pattern in the sysdesign-wiki corpus. Its four-element shape matches the pattern:

  1. Desired-state fileschema.hcl.
  2. Inspect primitiveatlas schema inspect.
  3. Diff engine — computed by the apply command.
  4. Apply primitiveatlas schema apply with operator-in-the-loop confirmation.

Skeema, Bytebase, and Prisma Migrate (in prisma db push mode) are sibling implementations not yet canonicalised on the wiki.

Seen in

  • [[sources/2026-04-21-planetscale-declarative-mysql- schemas-with-atlas-cli]] — first canonical wiki mention. Brian Morrison II walks through the two- command inspect / apply workflow on a PlanetScale MySQL branch: edit schema.hcl to add a description column to a hotels table, atlas schema apply prints the planned ALTER TABLE … ADD COLUMN … diff and prompts for confirmation, applies on enter. Post flags PlanetScale's safe-migrations feature as a must-disable precondition. Tutorial voice, not deep-dive — Atlas's internals (diff algorithm, destructive-change handling, policy/lint engine, migrate versioned mode) are not covered.

Related

Last updated · 347 distilled / 1,201 read