migration-db

Migrate applications to shared PostgreSQL db_commune with idempotent RBAC roles and schemas.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/Ascenseurs-Menetrey-SA/amsa-claude-skills --skill migration-db
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migration-db
Source: https://github.com/Ascenseurs-Menetrey-SA/amsa-claude-skills/tree/main/migration-db
Command: npx skills add https://github.com/Ascenseurs-Menetrey-SA/amsa-claude-skills --skill migration-db

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams migrate an application to the shared PostgreSQL database (db_commune) while preventing destructive conflicts like duplicate schemas, roles, PgBouncer aliases, or secrets.

Core Features & Use Cases

  • Pre-migration discovery: Inspects the source app (Alembic + Docker compose) and the target db_commune (roles, schemas, grants, PgBouncer, secrets) to understand the current state.
  • Conflict detection and guardrails: Blocks the migration when shared Phase 2 prerequisites are missing or when duplicates are detected; allows progress with warnings otherwise.
  • Idempotent db_commune updates: Creates the application RBAC roles and schema, wires PgBouncer routing, updates docker-compose secrets references, and sets passwords and grants safely.
  • Application integration: Attaches the db_commune network to the app, configures Alembic to use schemas, and documents the correct DATABASE_URL patterns for PgBouncer and migrations.

Quick Start

Ask the AI to run the migration for your app directory by providing the app name and absolute path, using the optional db_commune directory if needed.

Frequently Asked Questions about migration-db

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

FAQPage Schema
How do I migrate my application to a shared PostgreSQL database without causing schema or role conflicts?

Migrating an application to a shared PostgreSQL database requires provisioning idempotent RBAC roles, schemas, and connection secrets while enforcing conflict detection. This prevents destructive duplicates like conflicting PgBouncer aliases or overlapping database grants during the migration process.

What does Alembic schema-scoped migration require when moving to a shared PostgreSQL db?

Alembic schema-scoped migration requires configuring Alembic to use specific schemas and updating application network settings to attach to the shared database. It also requires validating shared prerequisites and updating docker-compose secrets references to ensure safe secret handling.

Can I use Docker compose to manage database connection secrets when migrating to a shared PostgreSQL setup?

Yes, Docker compose can manage database connection secrets by updating docker-compose secrets references to use existing VPS-generated secret files. This approach sets passwords and grants safely while wiring PgBouncer routing for the shared database access.

How do PgBouncer aliases work with RBAC roles during a PostgreSQL database migration?

PgBouncer aliases route connections from applications to the shared PostgreSQL database using specific RBAC roles. During migration, idempotent database updates wire PgBouncer routing and create application RBAC roles, ensuring secure and isolated schema-scoped access.

When should I block a database migration to a shared PostgreSQL instance?

You should block a database migration to a shared PostgreSQL instance when shared Phase 2 prerequisites are missing or when destructive duplicates are detected in roles, schemas, PgBouncer aliases, or secrets. The migration proceeds with warnings only for non-blocking issues.

Does pre-migration discovery inspect both the source application and the target shared PostgreSQL database?

Yes, pre-migration discovery inspects the source application using Alembic and Docker compose alongside the target shared PostgreSQL database. It checks existing roles, schemas, grants, PgBouncer configurations, and secrets to understand the current state before applying idempotent updates.