Atlas CLI is an open source tool that helps developers manage their database schemas by applying modern DevOps principles. Contrary to existing tools, Atlas intelligently plans schema migrations for you. Atlas users can use the Atlas DDL (data definition language) to describe their desired database schema and use the command-line tool to plan and apply the migrations to their systems.
On macOS:
brew install ariga/tap/atlas
Click here to read instructions for other platforms.
Get started with Atlas by following the Getting Started docs. This tutorial teaches you how to inspect a database, generate a migration plan and apply the migration to your database.
- Inspecting a database: easily inspect your database schema by providing a database URL.
atlas schema inspect -u "mysql://root:pass@localhost:3306/example" > atlas.hcl
- Applying a migration: generate a migration plan to apply on the database by providing an HCL file with the desired Atlas schema.
atlas schema apply -u "mysql://root:pass@localhost:3306/example" -f atlas.hcl
- Declarative Migrations vs. Versioned Migrations: Atlas offers two workflows. Declarative migrations allow the user to provide a desired state and Atlas gets the schema there instantly (simply using inspect and apply commands). Alternatively, versioned migrations are explicitly defined and assigned a version. Atlas can then bring a schema to the desired version by following the migrations between the current version and the specified one.
Read more about the motivation of the project here.
MySQL, MariaDB, PostgresSQL, SQLite, TiDB, CockroachDB