comparing-database-schemas
Installation
SKILL.md
Database Diff Tool
Overview
Compare database schemas between two environments (development vs. staging, staging vs.
Prerequisites
- Connection credentials to both source and target databases
psqlormysqlCLI configured to connect to both environments- Read access to
information_schemaandpg_catalog(PostgreSQL) orinformation_schema(MySQL) - Permission to run
pg_dump --schema-onlyfor full schema extraction - Understanding of which environment is the "source of truth" (typically the migration-managed environment)
Instructions
- Extract the full schema from both databases for comparison:
- PostgreSQL:
pg_dump --schema-only --no-owner --no-privileges -f schema_source.sql source_dband repeat for target_db - MySQL:
mysqldump --no-data --routines --triggers source_db > schema_source.sql - Alternatively, query
information_schemadirectly for programmatic comparison
- PostgreSQL:
Related skills