pg-migrations

Automate multi-tenant PostgreSQL migrations across all active schemas.

1|Updated Apr 17, 2026
One-click install
npx skills add https://github.com/PremModhaOfficial/motadata-ai-pipeline --skill pg-migrations
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pg-migrations
Source: https://github.com/PremModhaOfficial/motadata-ai-pipeline/tree/main/.claude/skills/pg-migrations
Command: npx skills add https://github.com/PremModhaOfficial/motadata-ai-pipeline --skill pg-migrations

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Efficiently orchestrate and apply schema-per-tenant PostgreSQL migrations across all active tenants with zero downtime, robust rollback, and auditing.

Core Features & Use Cases

  • Migration conventions: standardized 6-digit numbering, up/down pairing, and :schema placeholder usage to target each tenant schema.
  • Zero-downtime strategies: phases for adding columns, safe renames, and non-blocking index creation outside transactions.
  • Bounded worker migrations: parallel application of migrations across tenant schemas with a configurable concurrency cap.
  • Audit and observability: audit trigger setup and partitioned logs for change tracking across all tables.
  • Deployment readiness: supports rolling back migrations and ensuring all tenants are kept in sync during deploys.

Quick Start

Use the pg-migrations skill to scaffold and apply a new migration across all active tenant schemas.

Frequently Asked Questions about pg-migrations

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run zero-downtime PostgreSQL migrations across multiple tenant schemas?

Zero-downtime PostgreSQL migrations across tenant schemas are automated using a bounded worker pool to apply changes in parallel. This ensures every active schema receives updates concurrently during deployment without blocking database operations.

What is the best way to handle three-phase column changes for multi-tenant Postgres databases?

Three-phase column changes for multi-tenant Postgres databases involve phased additions, safe renames, and non-blocking index creation outside transactions. This strategy prevents locking issues and ensures migrations apply seamlessly across all active tenant schemas.

How does parallel schema migration work with a bounded worker pool?

Parallel schema migration with a bounded worker pool applies updates across tenant schemas concurrently up to a configurable concurrency cap. This orchestrates efficient deployment while preventing database overload during multi-tenant migration execution.

Do I need a tenant registry to apply schema-per-tenant migrations?

A tenant registry is required to apply schema-per-tenant migrations. The system uses this registry to identify active tenants, alongside migration templates with a :schema placeholder, to target and execute migrations across all specific schemas.

Can I roll back multi-tenant PostgreSQL migrations if a deployment fails?

Multi-tenant PostgreSQL migrations can be rolled back if a deployment fails. The system supports up/down migration pairing and robust rollback capabilities to ensure all tenants are kept in sync and restored to previous states.

How do I track database changes across all tenant schemas during migrations?

Database changes across all tenant schemas are tracked using audit trigger setup and partitioned logs. This provides observability and change tracking across all tables, ensuring deployment readiness and synchronized tenant states.