关于
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.
主要功能
- Extracts database schema from PostgreSQL migration files
- Uses temporary PostgreSQL instances via Testcontainers for safe schema discovery
- Provides schema in human-readable info mode or SQL DDL extract mode
- Supports native and pg_dump schema extraction providers for varying detail levels
- Integrates as an MCP server for AI tools, enabling automated schema extraction and validation
- 2 GitHub stars
使用案例
- Understanding the current state of a database schema in projects with long migration histories
- Generating SQL CREATE statements to recreate a database schema from its migrations
- Automating schema discovery and validation within AI development environments (e.g., Claude Code)