一键导入
add-migration
Generates numbered SQL migration files for tables, indexes, and views. Use when adding or modifying database schema.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Generates numbered SQL migration files for tables, indexes, and views. Use when adding or modifying database schema.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Crawls exchange API documentation and generates structured markdown specs. Use when integrating a new exchange or updating API specifications.
Systematically diagnoses build, runtime, DB, API, and frontend errors with classification and fix workflow. Use when encountering errors or test failures.
Commits code changes with automated CHANGELOG and design document updates. Runs build/lint verification before commit. Use after completing a feature, bug fix, or refactoring.
Scaffolds a new API endpoint with router, handler, OpenAPI docs, and TS bindings. Use when adding REST endpoints to trader-api.
Scaffolds a new exchange connector with connector, provider, and trait implementations. Use when integrating a new exchange.
Adds a new trading strategy across 5 locations (mod.rs, routes, backtest, SDUI schema, frontend). Use when implementing a new strategy.
| name | add-migration |
| description | Generates numbered SQL migration files for tables, indexes, and views. Use when adding or modifying database schema. |
| disable-model-invocation | true |
| user-invocable | true |
| argument-hint | <설명_snake_case> [테이블명|기능명] |
| allowed-tools | Read, Grep, Write, Bash(podman *) |
$ARGUMENTS 마이그레이션을 생성합니다.
ls migrations/ | sort | tail -1
현재 마지막 번호 + 1을 사용합니다.
위치: migrations/<번호>_$ARGUMENTS[0].sql
-- 마이그레이션: <설명>
-- 날짜: YYYY-MM-DD
-- 1. 테이블 생성 (IF NOT EXISTS 필수)
CREATE TABLE IF NOT EXISTS <테이블명> (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
-- 가격/수량 필드는 NUMERIC(20,8) 사용 (FLOAT 금지)
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW()
);
-- 2. 인덱스 (성능 최적화)
CREATE INDEX IF NOT EXISTS idx_<테이블>_<컬럼>
ON <테이블> (<컬럼>);
-- 3. TimescaleDB 하이퍼테이블 (시계열 데이터인 경우)
-- SELECT create_hypertable('<테이블>', 'created_at', if_not_exists => TRUE);
IF NOT EXISTS / IF EXISTS 사용 (멱등성)NUMERIC(20,8) (FLOAT 금지)create_hypertable 고려ON DELETE CASCADE 또는 SET NULL 명시# 1. 마이그레이션 적용
podman exec -i trader-timescaledb psql -U trader -d trader -f /dev/stdin < migrations/<번호>_$ARGUMENTS[0].sql
# 2. 테이블 확인
podman exec trader-timescaledb psql -U trader -d trader -c "\dt <테이블명>"
# 3. 스키마 확인
podman exec trader-timescaledb psql -U trader -d trader -c "\d <테이블명>"
.sql 파일 수정DROP TABLE IF EXISTS 후 재적용하여 검증 반복해당 테이블에 대한 Rust 구조체가 필요한 경우:
crates/trader-core/src/domain/ 또는 해당 crate에 모델 추가sqlx::FromRow derive 추가docs/migration_guide.md에 새 마이그레이션 정보 추가.