Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Feature Request] Supports @nullsNotDistinct column attribute

オープン
#2,747 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
postgresql, sqlite, typescript
領域
backend, databases

調査の方向性

This is a cross-dialect feature: the schema layer must accept a new @nullsNotDistinct column attribute, and the query/migration generators must emit NULLS NOT DISTINCT for postgresql and recent sqlite while compiling null-aware unique constraints for other dialects. Start by tracing how an existing attribute such as @unique is parsed and how unique indices are generated per provider, then run the provider test suites to see current coverage. Done means the attribute is accepted, NULLs compare equal for uniqueness on supporting databases, and documented fallbacks exist for the rest.

索引モデルが issue の本文から書いたものです。

説明

Is your feature request related to a problem? Please describe.
There is currently no good way to enforce uniqueness on nullable columns when you want two NULL values considered the same.

Describe the solution you'd like
For postgresql & recent versions of sqlite, use NULLS NOT DISTINCT, for other DB, compile queries to null aware operators and their equivalent and @@unique to partial/filtered unique indices.

Describe alternatives you've considered
Use some sentinel values that is not NULL on that column or some generated column. However, whether as an ad-hoc solution or plugin implemented by the user, or as a plugin/new feature added to zenstack itself, it's messy to work with due to a lack of a common null-ish value across various data types except for NULL, as well as need to insert dummy rows to satisfy referential integrity constraint on other tables when the said column is a foreign key.

Additional context
If any support for databases like SQL Server or Oracle were to be added, we should still retain the default defined behavior of considering nulls to be distinct by generating queries and filtered unique indices to enforce the inverse, rather than allow the whims of individual DBMS to define the behavior.

主要言語
TypeScript
スター
2.9k
フォーク
157
平均マージ
11時間 42分
マージ済み PR(30日)
20

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

zenstackhq/zenstack のほかの issue

zenstackhq/zenstack の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。