Skip to content

fix(codegen): a table without a create mutation has no Create<Table>Input, bulkCreate or bulkUpsert anywhere - #1988

Merged
pyramation merged 3 commits into
mainfrom
feat/codegen-no-create-input-import
Nov 11, 2026
Merged

pyramation merged 3 commits into
mainfrom
feat/codegen-no-create-input-import

Conversation

@pyramation

@pyramation pyramation commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #1986. That PR stopped emitting Create<Table>Input in input-types.ts when table.query.create === null. But the rest of the generated output still referenced it, so it no longer type-checked. constructive-db's regenerated storage file.ts / platformFile.ts hit this.

  • Imports: the ORM model and CLI command imports of Create<Table>Input are now gated on create.
  • Bulk create/upsert: both take Create<Table>Input, so a create-less table has neither. New getBulkInsertMutationName(table) / getBulkUpsertMutationName(table) in utils.ts return null without create. Every generator that read query.bulkInsert/bulkUpsert now goes through them: ORM model + docs, hooks, mutation keys, CLI commands + docs.
  • Custom mutation inputs: buildTableCrudTypeNames no longer reserves Create<Table>Input for a create-less table. A custom mutation that owns that name (e.g. createPrincipal(input: CreatePrincipalInput)) now gets it generated from the schema. Before this, it was dropped, and before fix(codegen): create is optional like update/delete #1986 it was emitted with the table's shape.

Tests:

  • orm-typecheck.test.ts generates the full ORM for a create-less table that has bulkInsert/bulkUpsert and type-checks it with ts.createProgram. On the previous head it fails with Cannot find name 'CreateFileInput'.
  • The model, CLI and input-types tests cover create-less tables.

Link to Devin session: https://app.devin.ai/sessions/7ffa2e370d49424bb81161cc2390ba12
Open in Devin Desktop: https://app.devin.ai/desktop/session/7ffa2e370d49424bb81161cc2390ba12?variant=devin
Requested by: @pyramation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@luxor-code-review

luxor-code-review Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Review complete. 🟡 1 medium

💬 Inline comments (1)


The change updates two GraphQL codegen generators so that tables lacking a create mutation no longer emit a create command or import the corresponding Create<T>Input type. The ORM model generator conditionally drops the create import and the create<Table> method, while the CLI table-command generator conditionally drops the create command module and its import; both add tests covering tables with create: null.

Files Change
graphql/codegen/src/core/codegen/cli/table-command-generator.ts Skips emitting the create command file/import/verb entry when createMutationName is null, keeping the generated CLI module list consistent.
graphql/codegen/src/core/codegen/orm/model-generator.ts Skips the Create<T>Input import and the generated create<Table> method when no create mutation exists.
graphql/codegen/src/__tests__/codegen/cli-generator.test.ts Adds a test asserting the CLI generator handles a table without a create mutation.
graphql/codegen/src/__tests__/codegen/model-generator.test.ts Adds a test asserting the ORM model generator handles a table without a create mutation.

Reviewed commit: fb73284

@luxor-code-review luxor-code-review Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR makes the CLI command generator and ORM model generator skip the create-command/import and CreateInput type when a table has no create mutation, but the ORM generator's remaining code paths still reference the omitted type.

Key findings

@devin-ai-integration devin-ai-integration Bot changed the title fix(codegen): no Create<Table>Input import for a table without a create mutation fix(codegen): a table without a create mutation has no Create<Table>Input, bulkCreate or bulkUpsert anywhere Nov 11, 2026
@pyramation
pyramation merged commit c79a4cd into main Nov 11, 2026
36 of 37 checks passed
@pyramation
pyramation deleted the feat/codegen-no-create-input-import branch November 11, 2026 06:45
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