Skip to content

feat: add @pgpmjs/migrate-client workspace package for typed Migrate API access#824

Open
pyramation wants to merge 1 commit intomainfrom
devin/1773568362-migrate-client-workspace
Open

feat: add @pgpmjs/migrate-client workspace package for typed Migrate API access#824
pyramation wants to merge 1 commit intomainfrom
devin/1773568362-migrate-client-workspace

Conversation

@pyramation
Copy link
Contributor

feat: add @pgpmjs/migrate-client workspace package

Summary

Adds a new workspace package at sdk/migrate-client/ that provides a typed GraphQL ORM client for the Constructive Migrate API (db_migrate schema). This package will be consumed by pgpm/core to replace ~1,300 lines of handwritten GraphQL boilerplate in the export flow (on the feature/pgpm-export-graphql branch).

Package contents:

  • schemas/migrate.graphql — static copy of the db_migrate GraphQL schema from constructive-db
  • Generated ORM models: SqlActionModel, MigrateFileModel (findMany/findFirst/create/update/delete)
  • Generated mutations: executeSql, runMigration
  • scripts/generate.ts — regeneration script using @constructive-io/graphql-codegen (devDep only)

Runtime dependencies are minimal: gql-ast, @0no-co/graphql.web, @constructive-io/graphql-types, graphql. No codegen dependency at runtime.

This PR also adds @pgpmjs/migrate-client as a workspace:^ dependency in pgpm/core/package.json, but no code in pgpm/core imports it yet — the actual usage will land via the export PR on feature/pgpm-export-graphql.

Review & Testing Checklist for Human

  • ORM code was copied, not locally generated. The pnpm generate script requires graphile-connection-filter (transitive codegen dep) which wasn't available in the build environment. The committed ORM files were copied from constructive-db's existing generated output. Verify that pnpm generate works in a fully-configured environment and produces identical output.
  • Schema drift. sdk/migrate-client/schemas/migrate.graphql is a one-time copy from constructive-db. If the upstream db_migrate schema changes, this file must be manually re-copied and pnpm generate re-run. Consider whether an automated sync is warranted.
  • Lock file diff is large but cosmetic. The pnpm-lock.yaml diff is ~90% YAML formatting changes (brace style). The substantive additions are only the sdk/migrate-client importer block and the @pgpmjs/migrate-client link in pgpm/core. Spot-check for unexpected dependency changes.
  • Build verification. Run pnpm build from workspace root — sdk/migrate-client and pgpm/core should both compile cleanly. Note: concurrent workspace builds can race (migrate-client's dist gets deleted while core compiles); building migrate-client first avoids this.

Notes

…API access

- Create sdk/migrate-client/ with typed ORM client generated from migrate.graphql schema
- Models: SqlActionModel, MigrateFileModel with findMany/findFirst/create/update/delete
- Mutations: executeSql, runMigration
- Zero codegen runtime deps (gql-ast, @0no-co/graphql.web, @constructive-io/graphql-types)
- Add pnpm generate script for future regeneration via @constructive-io/graphql-codegen
- Add @pgpmjs/migrate-client as workspace dependency in pgpm/core
@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

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