Skip to content

adjust(core): add option to make principal id nullable#29

Merged
haicao2805 merged 1 commit into
developfrom
haicao/develop
Jun 4, 2026
Merged

adjust(core): add option to make principal id nullable#29
haicao2805 merged 1 commit into
developfrom
haicao/develop

Conversation

@haicao2805
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings June 4, 2026 05:23
@haicao2805 haicao2805 merged commit 0deda83 into develop Jun 4, 2026
1 check passed
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

Adds support for generating nullable principal ID columns in the core Drizzle schema enricher utilities, enabling schemas where a polymorphic “principal” reference may be absent.

Changes:

  • Extended TPrincipalEnricherOptions / generatePrincipalColumnDefs generics to carry an “ID nullable” flag.
  • Updated TPrincipalColumnDef to conditionally return NotNull<...> vs nullable column builders.
  • Implemented runtime branching to omit .notNull() when isNullableId is enabled.

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

Comment on lines 5 to 14
export type TPrincipalEnricherOptions<
Discriminator extends string = string,
IdType extends 'number' | 'string' = 'number' | 'string',
Nullable extends boolean = false,
> = {
discriminator?: Discriminator;
defaultPolymorphic?: string;
polymorphicIdType: IdType;
isNullableId?: Nullable;
};
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