DB Schema Surgeon

Automate PostgreSQL schema migrations and sync metadata with Supabase vector stores.

Updated Dec 24, 2025
One-click install
npx skills add https://github.com/adriangmrraa/MultiAgents-Platform-ROI --skill db-schema-surgeon
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: DB Schema Surgeon
Source: https://github.com/adriangmrraa/MultiAgents-Platform-ROI/tree/main/.agent/skills/DB_Evolution
Command: npx skills add https://github.com/adriangmrraa/MultiAgents-Platform-ROI --skill db-schema-surgeon

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents schema drift and broken RAG metadata by automatically creating missing tables, running idempotent migration steps, and keeping PostgreSQL metadata synchronized with remote vector stores so the platform stays consistent across startups.

Core Features & Use Cases

  • Auto-Healing Startup: Runs create_all for new models and executes safe ALTER/INDEX statements to add missing columns or indexes without complex migration history.
  • Idempotent Migrations: Provides SQL migration steps using IF NOT EXISTS patterns to safely evolve production schemas and avoid destructive operations.
  • Hybrid RAG Management: Stores metadata locally in PostgreSQL while keeping embeddings in Supabase/pgvector and enforces a dual-delete protocol to maintain consistency.
  • Multitenancy & Identity Safety: Enforces tenant resolution patterns (UUID→INT) and recommends indexed foreign keys and performance-oriented indices.

Quick Start

Restart the orchestrator so it runs create_all and the idempotent migration steps to create missing tables and apply safe ALTER statements.

Frequently Asked Questions about DB Schema Surgeon

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

FAQPage Schema
How do I auto-heal PostgreSQL schema drift during application startup?

Auto-heal PostgreSQL schema drift by running create_all for new models and executing safe, conditional ALTER and INDEX statements at startup to add missing columns without complex migration history.

What is an idempotent SQL migration pattern for evolving production schemas?

An idempotent SQL migration pattern uses IF NOT EXISTS clauses to safely evolve production PostgreSQL schemas, ensuring missing tables and indexes are created without executing destructive operations on restart.

How do I keep PostgreSQL metadata synchronized with a Supabase vector store for RAG?

Keep PostgreSQL metadata synchronized with a Supabase vector store by storing metadata locally while keeping embeddings in pgvector, enforcing a dual-delete protocol to maintain RAG consistency.

Can I use this schema migration approach for multi-tenant PostgreSQL deployments?

Yes, this schema migration approach supports multi-tenant PostgreSQL deployments by enforcing tenant resolution patterns from UUID to INT and recommending indexed foreign keys for performance.

Why does my RAG ingestion workflow break after schema changes?

RAG ingestion workflows break after schema changes due to metadata desynchronization, which is prevented by automatically applying idempotent migrations and syncing PostgreSQL metadata with the remote vector store.