| name | Database Migration |
| description | Executes database migrations using the postgres MCP server. Use when applying schema changes, running migrations, or updating database structure. |
Database Migration
Execute and manage database migrations safely using MCP tools.
Instructions
Prerequisites
- Postgres MCP server configured in .mcp.json
- Migration files in migrations/ directory
- Database connection verified
Workflow
List pending migrations:
SELECT * FROM schema_migrations ORDER BY version;Read migration file from
migrations/{version}.sqlExecute in transaction:
BEGIN; -- migration SQL here INSERT INTO schema_migrations (version) VALUES ('{version}'); COMMIT;Verify schema changes:
SELECT column_name, data_type FROM information_schema.columns WHERE table_name = '{table}';Update Pydantic models in
modules/schemas.pyif needed
Examples
Example 1: Run a migration
User: "Apply the add-users-table migration"
- Read
migrations/001_add_users_table.sql - Execute via
mcp__postgres__query - Verify users table exists
- Update
modules/schemas.pywith new model - Confirm migration recorded