Mig2Schema

•
2
•

Extracts database schemas from PostgreSQL migration files by running a temporary database.

Mig2Schema is a command-line tool designed to understand the current state of a PostgreSQL database schema by analyzing its migration history. It spins up a temporary PostgreSQL instance using Testcontainers, applies all specified migration files, and then extracts the resulting schema. This is particularly useful for projects with extensive migration folders, allowing developers to quickly grasp the database structure without manual inspection or running complex setups.

主な機能

01Extracts database schema from PostgreSQL migration files
02Uses temporary PostgreSQL instances via Testcontainers for safe schema discovery
03Provides schema in human-readable info mode or SQL DDL extract mode
04Supports native and pg_dump schema extraction providers for varying detail levels
05Integrates as an MCP server for AI tools, enabling automated schema extraction and validation
062 GitHub stars

ユースケース

01Understanding the current state of a database schema in projects with long migration histories
02Generating SQL CREATE statements to recreate a database schema from its migrations
03Automating schema discovery and validation within AI development environments (e.g., Claude Code)