원클릭으로
database-migration
Generate, review, test, and deploy database schema migrations. Use when adding columns, creating tables, or changing schema.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Generate, review, test, and deploy database schema migrations. Use when adding columns, creating tables, or changing schema.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | database-migration |
| description | Generate, review, test, and deploy database schema migrations. Use when adding columns, creating tables, or changing schema. |
| argument-hint | [migration description, e.g. 'add user_profiles table'] |
| tools | ["run_in_terminal","read_file"] |
"Create a database migration for..." / "Add column..." / "Change schema..."
# Using golang-migrate
migrate create -ext sql -dir migrations -seq <description>
# Creates: migrations/NNNNNN_description.up.sql and migrations/NNNNNN_description.down.sql
# Using goose
goose -dir migrations create <description> sql
# Creates: migrations/YYYYMMDDHHMMSS_description.sql
Up migration (NNNNNN_description.up.sql):
CREATE TABLE IF NOT EXISTS orders (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id UUID NOT NULL,
customer_id UUID NOT NULL REFERENCES users(id),
total_amount NUMERIC(10,2) NOT NULL DEFAULT 0,
status VARCHAR(20) NOT NULL DEFAULT 'pending',
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_orders_tenant ON orders(tenant_id);
CREATE INDEX IF NOT EXISTS idx_orders_customer ON orders(tenant_id, customer_id);
Down migration (NNNNNN_description.down.sql):
DROP TABLE IF EXISTS orders;
# golang-migrate
migrate -path migrations -database "postgres://localhost:5432/contoso_dev?sslmode=disable" up
# goose
goose -dir migrations postgres "postgres://localhost:5432/contoso_dev?sslmode=disable" up
# Verify
psql -h localhost -d contoso_dev -c "\d orders"
go test ./tests/integration/... -v -tags=integration
migrate -path migrations -database "$STAGING_DB_URL" up
If migration fails → immediately run the rollback SQL (down migration), report the failure with the error message, and STOP. Do not proceed to deploy.
up.sql and down.sql filesIF NOT EXISTS / IF EXISTS guards| Shortcut | Why It Breaks |
|---|---|
| "I'll just edit the model directly" | Skipping the migration file means no rollback path and no deployment audit trail. Schema changes must be versioned. |
| "Rollback SQL isn't needed" | Deployments fail. Without rollback, recovery means restoring from backup — minutes of downtime vs seconds. |
| "I'll seed data manually" | Manual data changes drift between environments. Seeding must be scripted and repeatable. |
| "One migration for multiple changes is simpler" | Atomic migrations enable selective rollback. Bundled changes force all-or-nothing reversals. |
After completing this skill, confirm:
migrate -path migrations -database "$DB_URL" up succeeds on local databasego test ./tests/integration/... -v -tags=integration passes against migrated schemamigrate -path migrations -database "$DB_URL" down 1 runs cleanlysearch_thoughts("database migration", project: "<YOUR PROJECT NAME>", created_by: "copilot-vscode", type: "pattern") — load prior migration patterns, naming conventions, and lessons from failed migrationscapture_thought("Migration: <summary of schema change>", project: "<YOUR PROJECT NAME>", created_by: "copilot-vscode", source: "skill-database-migration") — persist the migration decision for future referenceRun a comprehensive code review across architecture, security, testing, naming, and patterns. Invokes relevant reviewer agents in sequence. Use before merging features or at the end of a phase. With --quorum, dispatches multi-model analysis for higher confidence.
Run a comprehensive code review across architecture, security, testing, naming, and patterns. Invokes relevant reviewer agents in sequence. Use before merging features or at the end of a phase. With --quorum, dispatches multi-model analysis for higher confidence.
Guided end-to-end bug-fix workflow for Plan Forge tempering bugs — load → pre-fix review → write failing test → fix → validate → post-fix sweep → close. Composes /code-review, /clean-code-review, /forge-quench, and /test-sweep around the forge_bug_* tool surface so a fix never closes without a regression check.
Guided end-to-end bug-fix workflow for Plan Forge tempering bugs — load → pre-fix review → write failing test → fix → validate → post-fix sweep → close. Composes /code-review, /clean-code-review, /forge-quench, and /test-sweep around the forge_bug_* tool surface so a fix never closes without a regression check.
Plan-Forge-tuned comprehensive code review — runs public-surface diff, forge analysis, architecture / security / testing / patterns checks, plus Plan-Forge-specific gates (ACI compliance, dual-shell parity, branch model). Use before merging features or at the end of a phase. With --quorum, dispatches multi-model analysis.
Stack-agnostic Clean Code audit — module size, function-length/complexity (via your project's existing linter), long parameter lists, TODO/FIXME/HACK markers, commented-out code, debug-print leakage, and optional duplication detection. Produces a structured findings report with optional fix suggestions. Use before merges, at end of a feature, or as a regular hygiene pass.