一键导入
dbmate
Managing database migrations with dbmate
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Managing database migrations with dbmate
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | dbmate |
| description | Managing database migrations with dbmate |
This skill provides comprehensive instructions for managing database migrations in this project using dbmate.
When creating new migrations, always follow the /migrate-new workflow. The primary tool for creating a migration is:
dbmate --migrations-dir db/migrations/<engine> new "migration_name"
Replace <engine> with sqlite, postgres, or mysql.
Migrations are stored in db/migrations/<engine>/ as .sql files. They follow a specific format:
Each migration file MUST have two sections:
-- migrate:up
-- SQL statements to apply the change
-- migrate:down
-- SQL statements to reverse the change
[!IMPORTANT] DO NOT wrap your SQL in
BEGIN/COMMITblocks.dbmateautomatically wraps each migration in a transaction. Adding manual transaction blocks will cause errors and may lead to inconsistent database states.
IF NOT EXISTS or similar where possible to make migrations safer (e.g., CREATE TABLE IF NOT EXISTS ...).db/schema/ manually. They are auto-generated.TEXT, JSONB).LONGTEXT for JSON-like data).ALTER TABLE support.For development, use ./dev-scripts/migrate-all.py. This script:
db/schema/.