feat(pgpm): pgpm diff --append-module — append the delta into an existing module - #1581
Merged
Conversation
…ting module Adds an append mode to pgpm diff: instead of writing a fresh package, emit the semantic delta into an existing pgpm module's plan. Existing changes, their deploy/revert/verify scripts, and the .control file are left byte-for-byte untouched; only the new changes are written and appended to pgpm.plan after the current changes. - appendModule() in @pgpmjs/transform: parses the existing plan, appends new Change entries + writes only the new change scripts (no rmSync of the tree), skips name collisions (never overwrites), and filters dangling internal deps out of the bracket with a warning (plan order still sequences them last) - pgpm diff --append-module <dir>: standalone (rejected with --emit-*/--verify, whose semantics assume the fresh-delta module) - e2e: append v1+delta into an existing module, assert existing scripts are untouched and the appended module fresh-deploys to the v2 catalog
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Summary
pgpm diffcould only emit its delta as a fresh package. This adds an append mode: emit the semantic delta into an existing pgpm module's plan, so you can grow one module version-over-version instead of accumulating separate migration packages.The core is a new
appendModulein@pgpmjs/transform— a non-destructive sibling ofwriteModule(whichrmSyncs the deploy/revert/verify tree and rewrites everything).appendModuletouches nothing that already exists:CLI:
pgpm diff <A> <B> --append-module <dir>. It's standalone — rejected together with--emit-migration/--emit-module/--emit-sql/--emit-bundle/--verify, since those all target the fresh-delta module model (e.g.--verify's oracle deploys the migration dir as just the delta on top of A).Tests
diff-e2egains an append case: build a standalone module holding v1's schema,pgpm diff … --append-modulethe v1→v2 delta into it, then assert (a) an existing change's deploy script is byte-for-byte unchanged, (b) the plan grew, and (c) the appended module (v1 + delta) fresh-deploys to a catalog equivalent to v2 (order-insensitive, since drop+add can't reproduce physical column ordinals). Full local run: diff-e2e 9/9, @pgpmjs/transform 85/85.Roadmap: the append-to-existing-module follow-up discussed for
pgpm diff(Part C of #1340).Link to Devin session: https://app.devin.ai/sessions/798445577ac8487abf80e28f9ff7a916
Requested by: @pyramation