atlas-migrations
БесплатноБез исполняемых скриптовНе проверенUse for any question or task about Atlas or declarative, Terraform-style database schema management, including how it compares with Flyway and Liquibase…
от testland★ 18 звёзд на GitHubОб этом скилле
atlas-migrations
Overview
Atlas manages and migrates database schemas as code - define the desired schema and Atlas plans, lints, tests, and applies the changes (per atlasgo.io/getting-started). Two operating modes:
- Declarative - define desired state in HCL or SQL; Atlas
computes diff and applies (
atlas schema apply). - Versioned - Atlas generates timestamped migration files from
schema diffs (
atlas migrate diff); migrations apply forward (atlas migrate apply).
Use versioned mode where every change needs a reviewed file and an audit trail; declarative mode suits fast local iteration.
How to use
Follow the steps in order. Lint and validate (Step 5) are the gate:
nothing reaches migrate apply (Step 6) until they pass.
Step 1 - Install
Per at-start:
# Homebrew (macOS / Linux)
brew install ariga/tap/atlas
# Docker: nothing to install, mount the migrations directory
docker run --rm --net=host -v "$(pwd)/migrations:/migrations" \
arigaio/atlas migrate apply --url "$DATABASE_URL"
In GitHub Actions, uses: ariga/setup-atlas@v0 puts the CLI on the
runner (Step 8, per at-gha). The getting-started page also
lists per-platform binaries with md5 and sha256 checksums; verify the
checksum before running a downloaded binary. Prefer these over piping
the vendor install script into a shell, which runs unreviewed remote
code.
Step 2 - Define schema
Per at-start, schema can be SQL (most common) or HCL. SQL example (PostgreSQL):
-- schema.sql
CREATE TABLE users (
id serial PRIMARY KEY,
name varchar(255) NOT NULL,
email varchar(255) UNIQUE NOT NULL,
created_at timestamptz DEFAULT now()
);
For the same schema expressed in Atlas's HCL DSL and guidance on when HCL vs SQL matters, see references/hcl-schema.md.
The dev DB referenced via --dev-url is a temporary scratch
database Atlas uses to compute the diff (Atlas applies the desired
state to the scratch DB, then computes the migration vs production).
Step 3 - Apply schema (declarative mode)
Per at-start:
atlas schema apply --url "$DATABASE_URL" --to file://schema.sql \
--dev-url "docker://postgres/17/dev?search_path=public"
--url = target DB; --to = desired schema definition; --dev-url
= scratch DB for diff computation. Atlas prints the planned changes
and prompts for confirmation by default.
Step 4 - Generate versioned migrations
Per at-start:
atlas migrate diff initial --to file://schema.sql \
--dev-url "docker://postgres/17/dev?search_path=public"
This generates a timestamped migration file in migrations/ (e.g.,
20260506120000_initial.sql). Subsequent calls with a new schema
generate new migrations against the previous state.
Step 5 - Gate: validate and lint before any apply
atlas migrate lint needs Atlas Pro from v0.38 (atlas login first);
without it, keep migrate validate and use the migration-blast-radius-reviewer
agent for the risk review ([lint docs][at-lint]).
Make the risky analyzers fail. Only
destructivefails lint by default (exit code 1); data-dependent and backward-incompatible findings are only reported ([analyzers][at-an]). Turn them into errors inatlas.hcl:lint { data_depend { error = true } # MF1xx: NOT NULL add, new unique index on existing data incompatible { error = true } # BC1xx: rename / drop of tables and columns }Run the gate:
atlas migrate validate --dir "file://migrations" \ --dev-url "docker://postgres/17/dev?search_path=public" atlas migrate lint --dir "file://migrations" \ --dev-url "docker://postgres/17/dev?search_path=public" --latest 1validatechecks the directory againstatlas.sumand, with--dev-url, replays the files to check the SQL ([CLI reference][at-cli]).Fix and re-lint. For each finding, change the migration, not the rule: add a
DEFAULTor backfill beforeSET NOT NULL(MF103/MF104), split a rename into add-copy-drop across releases (BC), build the indexCONCURRENTLYon PostgreSQL (PG1xx). Re-runatlas migrate diff/atlas migrate hashafter editing an unapplied file, then repeat step 2 until it exits 0. Suppress a finding with-- atlas:nolint <code>only with a comment saying why and a reviewer's sign-off.
Step 6 - Apply versioned migrations
atlas migrate apply --url "$DATABASE_URL" --dry-run # print the SQL
atlas migrate apply --url "$DATABASE_URL"
Read the dry-run SQL before the real run ([CLI reference][at-cli]). Atlas
records each applied version in the atlas_schema_revisions table, so
the next apply starts after the last recorded one.
Step 7 - Hash and integrity
atlas.sum holds a hash pe
Установить atlas-migrations в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл atlas-migrations?
Use for any question or task about Atlas or declarative, Terraform-style database schema management, including how it compares with Flyway and Liquibase: Atlas schema apply, migrate diff against a dev database, migrate lint for destructive or locking changes, and migrate hash, across a dozen databases.
Как установить скилл atlas-migrations?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл atlas-migrations запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic