Skip to content

Make all properties of InsertType optional for DB schema compatibility#169

Merged
andrewzolotukhin merged 1 commit intodevelopmentfrom
fix/deep
Apr 14, 2026
Merged

Make all properties of InsertType optional for DB schema compatibility#169
andrewzolotukhin merged 1 commit intodevelopmentfrom
fix/deep

Conversation

@andrewzolotukhin
Copy link
Copy Markdown
Contributor

…ility with generated DB schemas

Description

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactor / internal improvement

Checklist

  • I've added tests for my changes
  • I've run npm run lint and fixed any issues
  • I've run npm run test and all tests pass
  • I've added a changeset (npx changeset) if this changes package behavior

Copilot AI review requested due to automatic review settings April 14, 2026 12:46
@andrewzolotukhin andrewzolotukhin merged commit 5f44e46 into development Apr 14, 2026
2 checks passed
@andrewzolotukhin andrewzolotukhin deleted the fix/deep branch April 14, 2026 12:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adjusts @cleverbrush/knex-schema’s InsertType helper to better match DB-driven insert scenarios where some fields may be generated by the database (e.g., auto-increment IDs), by making insert-input properties optional.

Changes:

  • Redefines InsertType<T> to infer from T.makeAllPropsOptional() instead of InferType<T>.
  • Updates the inline documentation comment for InsertType.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

export type InsertType<
T extends ObjectSchemaBuilder<any, any, any, any, any, any, any>
> = InferType<T>;
> = InferType<ReturnType<T['makeAllPropsOptional']>>;
Comment on lines +190 to +194
// InsertType — all properties optional (DB may generate some, e.g. SERIAL id)
// ---------------------------------------------------------------------------
export type InsertType<
T extends ObjectSchemaBuilder<any, any, any, any, any, any, any>
> = InferType<T>;
> = InferType<ReturnType<T['makeAllPropsOptional']>>;
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.

2 participants