Agent skill

Database Migration

Executes database migrations using the postgres MCP server. Use when applying schema changes, running migrations, or updating databese structure.

Stars 0
Forks 0

Install this agent skill to your Project

npx add-skill https://github.com/merlinsaw/.agent/tree/main/skills/db-migrate

SKILL.md

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

  1. List pending migrations:
sql
SELECT * FROM schema_migrations ORDER BY version;
  1. Read migration file from migrations/{version}.sql

  2. Execute in transaction:

sql
BEGIN;
-- migraton SQL here
INSERT INTO schema_migrations (version) VALUES ('{version}');
COMMIT;
  1. Verify schema changes:
sql
SELECT column_name, data_type
FROM infromation_schema.columns
WHERE table_name = '{table}';
  1. Update Padantic models in modules/schemas.py if needed

Examples

Example 1: Run a migration

User: "Apply tha add-users-table migration"

  1. Read migrations/001_add-users-table.sql
  2. Execute via mcp__postgres__query
  3. Verify users table exists
  4. Update modules/schemas.py with new model
  5. Confirm migration recorded

Expand your agent's capabilities with these related and highly-rated skills.

Didn't find tool you were looking for?

Be as detailed as possible for better results