pg-schema-diff
Go library for diffing Postgres schemas and generating SQL migrations
File Explorer
Download Latest Version (.zip)- bug_report.md
- feature_request.md
- code-gen.yaml
- lint.yaml
- run-tests.yaml
- pull_request_template.md
- assert-no-diff.sh
- Dockerfile.codegen
- Dockerfile.lint
- Dockerfile.test
- apply_cmd.go
- apply_cmd_test.go
- cli.go
- datastructs.go
- dump_cmd.go
- dump_cmd_test.go
- flags.go
- flags_test.go
- main.go
- main_test.go
- plan_cmd.go
- plan_cmd_test.go
- sql.go
- version_cmd.go
- future.go
- future_test.go
- goroutine_limiter.go
- goroutine_limiter_test.go
- encode_dot.go
- encode_dot_test.go
- graph.go
- graph_test.go
- 0.sql
- 0.sql
- 1.sql
- 0.sql
- 0.sql
- 1.sql
- acceptance_test.go
- check_constraint_cases_test.go
- column_cases_test.go
- data_packing_cases_test.go
- database_schema_source_cases_test.go
- enum_cases_test.go
- extensions_cases_test.go
- foreign_key_constraint_cases_test.go
- function_cases_test.go
- index_cases_test.go
- index_no_concurrent_cases_test.go
- local_partition_index_cases_test.go
- materialized_view_cases_test.go
- materialized_view_index_cases_test.go
- named_schema_cases_test.go
- partitioned_index_cases_test.go
- partitioned_table_cases_test.go
- policy_cases_test.go
- privilege_cases_test.go
- procedure_cases_test.go
- schema_cases_test.go
- sequence_cases_test.go
- table_cases_test.go
- trigger_cases_test.go
- view_cases_test.go
- dump.go
- dump_test.go
- actions.go
- db.go
- engine.go
- engine_test.go
- identifier.go
- identifier_test.go
- dml.sql.go
- models.sql.go
- queries.sql
- queries.sql.go
- README.md
- sqlc.yaml
- escape_test.go
- filters.go
- filters_test.go
- schema.go
- schema_test.go
- set.go
- set_test.go
- closer.go
- closer_test.go
- diff.go
- enum_sql_generator.go
- enum_sql_generator_test.go
- function_sql_vertex_generator.go
- materialized_view_sql_generator.go
- named_schema_sql_generator.go
- plan.go
- plan_generator.go
- plan_generator_test.go
- plan_test.go
- policy_sql_generator.go
- policy_sql_generator_test.go
- privilege_sql_generator.go
- procedure_sql_vertex_generator.go
- schema_migration_plan_test.go
- schema_source.go
- sql_generator.go
- sql_generator_test.go
- sql_graph.go
- sql_vertex_generator.go
- transform_diff.go
- transform_diff_test.go
- trigger_sql_vertex_generator.go
- view_sql_generator.go
- logger.go
- schema.go
- schema_test.go
- queryable.go
- factory.go
- factory_test.go
- multiline_sql_strings_lint.go
- codegen.sh
- .editorconfig
- .gitignore
- .golangci.yaml
- .sqlfluff
- CLAUDE.md
- CODE_OF_CONDUCT.md
- CONTRIBUTING.md
- go.mod
- go.sum
- LICENSE.md
- Makefile
- README.md
# Installation Guide
git clone https://github.com/stripe/pg-schema-diff
Downloads the entire project code from GitHub to your computer.
cd pg-schema-diff
Moves into the project folder you just downloaded.
2. Official Install Script
Easy Recommendedbrew install pg-schema-diff
Installs the pre-built package via Homebrew β no source build required.
go install github.com/stripe/pg-schema-diff/cmd/pg-schema-diff@latest
Downloads and installs the specified version directly β no need to clone the repo yourself.
Pulled directly from this repo's README.
3. Docker
Easy- Git Needed to download the project code from GitHub.
- Docker Desktop Needed to build and run containers. Install it and keep it running in the background.
docker build -f build/Dockerfile.codegen -t pg-schema-diff .
Builds a runnable image based on the Dockerfile.
docker run -p 8080:80 pg-schema-diff
Runs the built image as an actual container.
4. Go
Mediumgo install github.com/stripe/pg-schema-diff/cmd/pg-schema-diff@latest
Downloads and installs the specified version directly β no need to clone the repo yourself.
Pulled directly from this repo's README.
5. Make
Medium- Git Needed to download the project code from GitHub.
- Make Usually pre-installed on Linux/macOS. On Windows, install separately (e.g. via MSYS2 or WSL).
make
Compiles the code based on the generated build configuration to produce an executable.
