atlas
Atlas database migration tool best practices and usage. Use when creating migrations, modifying database schemas, troubleshooting migration errors, or answering questions about Atlas workflow (diff, apply, lint, hash, versioned migrations). --- # Atlas Migrations Atlas is a declarative database schema management tool. You declare the desired schema state, Atlas generates the migration SQL to get there. ## Core Concept Atlas uses a **declarative** approach: 1. You edit schema source files (the desired state). 2. Atlas compares desired state vs. current migration history. 3. Atlas generates the migration SQL automatically. You never write migration SQL by hand. ## Project Layout ``` atlas.hcl # Atlas configuration internal/db/ schemas/ main.sql # Entry point — imports all tables tables/ auth_user.sql # One file per table auth_session.sql shop_order.sql migrations/ 20260317041843_description.sql # Generated migrations (never edit) atlas.sum # Integrity hash (never edit) queries/ # sqlc query files (separate concern) ``` ## Configuration (atlas.hcl) ```hcl variable "dev_url" { type = string default = "sqlite://dev?mode=memory" } env "local" { src = "file://internal/db/schemas/main.sql" dev = var.dev_url migration { dir = "file://internal/db/migrations" } } ```
Changelog: Source: GitHub https://github.com/CherryHQ/stella
Loading comments...