Architecture of pgplex/pgschema
pgplex/pgschema is 1,504 source files holding 2,775 symbols across 7 modules, written mainly in Go, Shell, Python. The largest module is testdata, with 1,255 files, and 1 file is an entry point into the dependency graph.
How pgschema fits together
The entry point main.go starts the program and hands control to the command layer in cmd, which parses CLI input and loads configuration and ignore rules. The ir directory inspects the live PostgreSQL catalog and normalizes objects such as tables and functions into a stable internal representation, with ir/inspector.go and ir/normalize.go doing this work. The internal/diff directory, including internal/diff/diff.go, compares the desired schema with that representation to decide which changes are needed. The internal/color package then colorizes the plan output, and the testutil directory supplies Postgres test instances and fixtures for integration tests.
Largest modules
- testdata: 1,255 files and 29,164 lines of code
- internal: 61 files and 17,459 lines of code
- cmd: 48 files and 10,189 lines of code
- docs: 48 files and 5,654 lines of code
- .trellis: 36 files and 4,628 lines of code
- .claude: 30 files and 3,448 lines of code
- ir: 15 files and 7,188 lines of code
- root: 5 files and 449 lines of code
Languages
By file count: Go 121 files, Shell 19 files, Python 3 files, Dockerfile 1 file.
Documentation
Repowise documents pgschema in 357 pages generated from the source, 13 of them written explanations of the repository and its modules. Module guides include:
- root: Application Entrypoint
- cmd: CLI Dump and Planning
- internal/color: Colorized Plan Output
More on pgschema: summary and FAQ, codebase overview, code health.
Related guide: Best dependency graph tools for monorepos