Pgpkgmigrations#437
Merged
Merged
Conversation
gadomski
requested changes
May 11, 2026
Co-authored-by: Pete Gadomski <pete.gadomski@gmail.com>
Co-authored-by: Pete Gadomski <pete.gadomski@gmail.com>
- expand pgstac-migrate README with full CLI/API/env var docs and troubleshooting - make psycopg[binary] mandatory in pgstac-migrate and pypgstac - make psycopg-pool mandatory in pypgstac - remove redundant psycopg optional/group wiring and update test script flags - remove pgstac-migrate upper bound in pypgstac dependency - update release workflow paths and uv setup/build step - refresh docs/changelog references for pgpkg>=0.1.1 - regenerate uv lockfiles
gadomski
approved these changes
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Technical Context
pgstac.X.Y.Z.sql/pgstac.X.Y.Z-A.B.C.sqltopgstac--X.Y.Z.sql/pgstac--X.Y.Z--A.B.C.sql. Any tooling or scripts that reference migration files by the old dotted naming convention will need to be updated. Thepypgstac migrateCLI and Python API continue to work without changes.Description
This PR introduces
pgstac-migrate, a new lightweight standalone Python package that owns all of PgSTAC's runtime migration logic, and backsstageversion/makemigrationwith pgpkg for reproducible SQL assembly and diff-based migration generation.Migration filename canonicalization
All migration files are renamed to use the double-dash separator:
pgstac.0.9.10.sql → pgstac--0.9.10.sql
pgstac.0.9.10-0.9.11.sql → pgstac--0.9.10--0.9.11.sql
This matches the standard PostgreSQL extension file naming convention (
<extension>--<version>.sql,<extension>--<from>--<to>.sql), removes ambiguity between version separators and the dots in version numbers, and improves interoperability with extension tooling like pgpkg.New
pgstac-migratepackagesrc/pgstac-migrate/is a focused package that can be installed independently ofpypgstac:pgstac-migrate migrate [--to VERSION] [--dry-run], plusinfo,versions,plan,build-artifactpgstac_migrate.api.migrate(target, conninfo, ...)— usable directly without the full pypgstac stackmigrations.tar.zstbundle at publish time. This ships at 74 KB versus the 8.1 MB of raw SQL thatpypgstacpreviously bundled via a symlink — roughly a 110× reduction in migration payload. Those bytes move entirely out ofpypgstacand intopgstac-migrate.pypgstac migrateis maintained as a compatibility wrapper — with planned deprecationpypgstac migratecontinues to work exactly as before;Migrate.run_migration()now delegates topgstac_migrate.api.migrate()internally. No changes to calling code are required. This compatibility surface will be maintained for the near term but is planned for deprecation in a future minor release. Users should begin migrating topgstac-migrateCLI or API directly.pgpkg-backed
stageversionandmakemigrationThe in-container scripts now use
pgpkgfor SQL assembly and migration diffing, replacing the previous approach that usedmigraagainst two live databases. The optionalPGPKG_LOCAL_REPO_DIR/PGPKG_REPO_DIRenvironment variable allows testing against a local pgpkg checkout; default behavior resolves pgpkg from PyPI with no local setup required.Reviewers: please focus on
src/pgstac-migrate/(new package structure and API surface),src/pypgstac/src/pypgstac/migrate.py(delegation wiring), and the cross-surface parity test atsrc/pgstac-migrate/tests/test_parity.pywhich asserts both tools produce identical ordered SQL for all migration paths.Checklist
src/pgstac-migrate/tests/— CLI delegation, API, version source, and cross-surface plan parity (7 parametrized cases asserting pgstac-migrate catalog and pypgstac MigrationPath produce identical SQL file sequences)src/pypgstac/tests/test_migrate_wrapper.py— delegation and compat layer coveragescripts/container-scripts/testwired to run pgstac-migrate tests in CICHANGELOG.mdanddocs/src/release-notes.mdupdated;CONTRIBUTING.mdupdated to reflect two PyPI packages and new release workflow;CLAUDE.mdandAGENTS.mdupdated with pgstac-migrate architecture and migration-engineer workflowAI tool usage