-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: added option nulls not distinct to addUniqueConstraint method, updated docs * chore: cleanup * chore: reverted site changes * fix: use builder for unique constraint * fix: unit test * added 'nulls not distinct' modifier to addColumn * feat: added 'nulls not distinct' to create index * test: added unit test for alter table, add column * feat: added nulls not distinct option for alter table, add unique constraint * chore: cleanup * chore: cleanup * test: added typing checks for alter table and nullsNotDistinct * Update src/schema/unique-constraint-builder.ts Co-authored-by: Igal Klebanov <[email protected]> * Update src/query-compiler/default-query-compiler.ts Co-authored-by: Igal Klebanov <[email protected]> * fix: pull request comments * fix: moved quote for consistency with another unit test * test: added positive unit tests, fixed formatting --------- Co-authored-by: Igal Klebanov <[email protected]>
- Loading branch information
1 parent
31c5258
commit 4e40aa8
Showing
13 changed files
with
452 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { OperationNodeSource } from '../operation-node/operation-node-source.js' | ||
import { UniqueConstraintNode } from '../operation-node/unique-constraint-node.js' | ||
import { preventAwait } from '../util/prevent-await.js' | ||
|
||
export class UniqueConstraintNodeBuilder implements OperationNodeSource { | ||
readonly #node: UniqueConstraintNode | ||
|
||
constructor(node: UniqueConstraintNode) { | ||
this.#node = node | ||
} | ||
|
||
toOperationNode(): UniqueConstraintNode { | ||
return this.#node | ||
} | ||
|
||
/** | ||
* Adds `nulls not distinct` to the unique constraint definition | ||
* | ||
* Supported by PostgreSQL dialect only | ||
*/ | ||
nullsNotDistinct(): UniqueConstraintNodeBuilder { | ||
return new UniqueConstraintNodeBuilder( | ||
UniqueConstraintNode.cloneWith(this.#node, { nullsNotDistinct: true }) | ||
) | ||
} | ||
} | ||
|
||
preventAwait( | ||
UniqueConstraintNodeBuilder, | ||
"don't await UniqueConstraintNodeBuilder instances directly." | ||
) | ||
|
||
export type UniqueConstraintNodeBuilderCallback = ( | ||
builder: UniqueConstraintNodeBuilder | ||
) => UniqueConstraintNodeBuilder |
Oops, something went wrong.
4e40aa8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
kysely – ./
www.kysely.dev
kysely.dev
kysely-kysely-team.vercel.app
kysely-git-master-kysely-team.vercel.app