Skip to content

feat: add @pgpmjs/migrate-client workspace package with zero codegen deps#834

Merged
pyramation merged 2 commits intomainfrom
devin/1773712259-migrate-client-no-circular-deps
Mar 17, 2026
Merged

feat: add @pgpmjs/migrate-client workspace package with zero codegen deps#834
pyramation merged 2 commits intomainfrom
devin/1773712259-migrate-client-no-circular-deps

Conversation

@pyramation
Copy link
Contributor

@pyramation pyramation commented Mar 17, 2026

Summary

Adds sdk/migrate-client/ as a new workspace package (@pgpmjs/migrate-client) providing a typed GraphQL ORM client for the Constructive Migrate API (db_migrate schema).

The key design decision: the codegen generation script lives in sdk/constructive-sdk/scripts/generate-migrate-client.ts, not in migrate-client itself. This avoids circular dependencies — since pgpm/core will import @pgpmjs/migrate-client, having codegen as a devDep in migrate-client could create a cycle if codegen depends on anything in pgpm/core's dependency chain.

Changes:

  • sdk/migrate-client/ — new workspace package with generated ORM, schema, tsconfig, README
  • sdk/constructive-sdk/scripts/generate-migrate-client.ts — codegen script that reads from ../migrate-client/schemas/ and outputs to ../migrate-client/src/
  • sdk/constructive-sdk/package.json — added generate:migrate-client script
  • pgpm/core/package.json — added @pgpmjs/migrate-client workspace dependency
  • pnpm-lock.yaml — updated (includes cosmetic reformatting by pnpm)

To regenerate the ORM: pnpm --filter @constructive-io/sdk run generate:migrate-client

Updates since last revision

  • Stripped trgm fields from schema: Removed all *TrgmSimilarity computed fields, searchScore, fullTextSearch, TrgmSearchInput type, trgm* filter inputs, and *_TRGM_SIMILARITY_*/SEARCH_SCORE_* orderBy values from migrate.graphql. These were artifacts from an instance with pg_trgm enabled and not relevant to the base migrate API.
  • Regenerated ORM from the cleaned schema — all trgm references are gone from generated code.
  • Aligned tsconfig files with other SDK packages: tsconfig.json now extends ../../tsconfig.json; tsconfig.esm.json uses ESNext module + bundler moduleResolution.
  • Updated README with logo, CI badge, license badge, version badge, and disclaimer footer matching other packages in the repo.

Review & Testing Checklist for Human

  • Verify deps type correctness: The generated input-types.ts still types deps as string | null in some interfaces (e.g. SqlAction, SqlActionPatch), but the GraphQL schema declares deps: [String] (an array). The SqlActionInput interface correctly has deps?: string[]. This inconsistency suggests the codegen's array-type mapping still has a gap for non-input types. Check whether this blocks downstream usage in pgpm/core.
  • Confirm pgpm/core usage: @pgpmjs/migrate-client is added as a dep to pgpm/core but no import/usage of it appears in this diff. Verify this is intentional (i.e., usage comes in a follow-up PR).
  • Verify trgm stripping completeness: The schema was manually stripped of trgm fields rather than re-exported from a clean DB instance. Spot-check migrate.graphql for any remaining search-related artifacts that shouldn't be in the base schema.
  • Test generation round-trip: Run pnpm --filter @constructive-io/sdk run generate:migrate-client from the workspace root and confirm the output in sdk/migrate-client/src/migrate/orm/ looks correct.

Notes

Requested by: @pyramation
Link to Devin Session

…deps

- Add sdk/migrate-client/ workspace package for typed Migrate API access
- Move codegen generate script to sdk/constructive-sdk/scripts/ to avoid
  circular deps (migrate-client has no codegen devDep)
- Regenerate ORM from main's fixed codegen (input-types-generator fixes)
- Add @pgpmjs/migrate-client dependency to pgpm/core
- migrate-client generate script runs via:
  pnpm --filter @constructive-io/sdk run generate:migrate-client
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

…README to repo conventions

- Remove all TrgmSimilarity computed fields and trgm search inputs from migrate.graphql
- Remove searchScore, fullTextSearch, and TrgmSearchInput type from schema
- Regenerate ORM from cleaned schema
- tsconfig.json now extends ../../tsconfig.json (matching other SDK packages)
- tsconfig.esm.json uses ESNext module + bundler moduleResolution (matching others)
- README.md updated with logo, CI badge, license badge, version badge, and disclaimer
@pyramation pyramation merged commit 1fbcc65 into main Mar 17, 2026
43 checks passed
@pyramation pyramation deleted the devin/1773712259-migrate-client-no-circular-deps branch March 17, 2026 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant