pg-tenant-provisioning

Provision PostgreSQL 18 tenant schemas with migrations and registry registration.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provisioning a new tenant in a multi-tenant PostgreSQL 18 environment by creating a dedicated per-tenant schema, applying migrations, and registering the tenant in the management registry to ensure isolation and lifecycle control.

Core Features & Use Cases

  • Create tenant schemas deterministically with the t_{8hex} pattern and a dedicated _mgmt schema to store the registry and migrations.
  • Apply migrations to a specific tenant schema using a :schema placeholder and a shared pool, then register the tenant as active in _mgmt.tenant_registry.
  • Manage tenant lifecycle: onboarding (provision), deprovisioning, and archival of registry records with status transitions.

Quick Start

Provision a new tenant by supplying the tenant UUID and app DB name to create the schema, run migrations, and register the tenant in the registry.

Frequently Asked Questions about pg-tenant-provisioning

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

FAQPage Schema
How do I automate schema-per-tenant provisioning in PostgreSQL 18?

Schema-per-tenant provisioning in PostgreSQL 18 is automated by deterministically creating a dedicated schema, applying migrations with a :schema placeholder, and registering the tenant in a management registry for lifecycle control.

What is the schema-per-tenant pattern for multi-tenant PostgreSQL databases?

The schema-per-tenant pattern isolates tenants by creating a dedicated PostgreSQL schema for each one. This Skill uses a deterministic t_{8hex} naming pattern and a shared _mgmt schema to store the tenant registry and migrations.

How do I apply database migrations to a specific tenant schema using a shared pgxpool?

You apply migrations to a specific tenant schema using a shared pgxpool by utilizing a :schema placeholder in the SQL migration files, which ensures each migration targets the correct isolated schema.

Can I manage tenant deprovisioning and lifecycle statuses in PostgreSQL?

Yes, tenant deprovisioning and lifecycle management are supported. The Skill registers tenants as active in the _mgmt.tenant_registry and handles status transitions for onboarding, deprovisioning, and archival workflows.

Do I need a shared pgxpool and a dedicated _mgmt schema for tenant provisioning?

Yes, a shared pgxpool is required to execute the migration commands, and a dedicated _mgmt schema is needed to store the tenant registry and track the lifecycle statuses of the provisioned schemas.