This skill should be used when the user asks about "Atlas basics", "declarative vs versioned migrations", "Atlas workflows", "what is Atlas", "how does Atlas work", "Atlas migration approaches", "schema-as-code", "Atlas project setup", or needs an introduction to Atlas database migration concepts and workflow comparison
Atlas is a language-independent tool for managing and migrating database schemas using modern DevOps principles. It provides two distinct workflows for handling database migrations.
The declarative approach works like Terraform for databases:
Best for: Teams wanting infrastructure-as-code database management, minimal migration files.
The approach uses explicit migration files like traditional tools:
Best for: Teams needing explicit control, audit trails, and compatibility with existing migration tools.
Define your database structure in one of three ways:
HCL: Atlas-native language with rich features like templates and validations
table "users" {
schema = schema.public
column "id" {
type = int
auto_increment = true
}
primary_key {
columns = [column.id]
}
}
SQL: Standard DDL statements
CREATE TABLE users (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL
);
ORM: Generate from your ORM models (Prisma, GORM, Django, etc.)
Atlas generates migration plans by:
The atlas.hcl file centralizes your migration setup:
env "dev" {
url = "mysql://user:pass@localhost/mydb"
dev = "mysql://user:pass@localhost/dev"
migration {
dir = "file://migrations"
}
format {
migrate {
apply = format_sql
}
}
}
| Feature | Declarative | Versioned |
|---|---|---|
| Schema files | Single desired-state | Multiple versioned |
| Auto-planning | Yes | Yes |
| Rollback | Via state comparison | Via explicit down migrations |
| Audit trail | State history | Explicit migration files |
| Learning curve | Lower | Moderate |
| Team control | Less granular | More explicit |
# macOS with Homebrew
brew install ariga/tap/atlas
# Linux/Windows via curl
curl -sSf https://atlasgo.sh | sh
# Docker
docker pull arigaio/atlas
Use declarative to version control your schema and automatically synchronize databases across environments.
Use versioned to maintain explicit migration history while gaining Atlas's planning and linting benefits.
Use schema from ORM to keep Atlas in sync with your GORM/Prisma models automatically.
Use environment configuration to manage different databases (dev, staging, prod) with single migration definitions.
For complete documentation, see:
references/atlas-docs-full/docs.md - Full main documentationreferences/atlas-docs-full/getting-started.md - Complete installation guidereferences/README.md - Index of all 103+ documentation files