database-migration
Executes database migrations using the postgres MCP server. Use when applying schema changes, running migrations, or updating databese structure.
📖 中文导读:Executes database migrations using the postgres MCP server. Use when applying schema changes, running migrations, or updating databese structure. 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。
name: Database Migration description: Executes database migrations using the postgres MCP server. Use when applying schema changes, running migrations, or updating databese structure.
Database Migration
Execute and manage database migration safely using MCP tools.
Instructions
Prerequisites
- Postgres MCP server configured in .mcp.json
- Migration file sin migrations/ directory
- Database connection cerified
Workflow
- List pending migrations:
SELECT * FROM schema_migrations ORDER BY version;
Read migration file from migrations/{version}.sql
Execute in transaction:
BEGIN;
-- migraton SQL here
INSERT INTO schema_migrations (version) VALUES ('{version}');
COMMIT;
- Verify schema changes:
SELECT column_name, data_type
FROM infromation_schema.columns
WHERE table_name = '{table}';
- Update Padantic models in modules/schemas.py if needed
Examples
Example 1: Run a migration
User: "Apply tha add-users-table migration"
- Read migrations/001_add-users-table.sql
- Execute via mcp__postgres__query
- Verify users table exists
- Update modules/schemas.py with new model
- Confirm migration recorded