Split a PostgreSQL Schema into PGPM Packages
Dan Lynch
So far each projection has produced one package. Use a partition when you want separate packages for objects that belong together. Here, route the reporting schema into its own package and put everything else in library-core.
bashcat > partition.json <<'JSON' { "defaultPackage": "library-core", "rules": [ { "package": "library-reporting", "select": [{ "schema": "reporting" }] } ] } JSON pgpm transform --cwd ./packages/library --granularity object \ --partition ../../partition.json --out ../../projections/partitioned --check cat projections/partitioned/library-reporting/library-reporting.control
Look for library-core in the reporting package's requires field. pgpm derived that dependency because the reporting view reads from library.books. The same --check now compares the original module against both generated packages deployed in dependency order.

