Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

[Feature Request] Supports @nullsNotDistinct column attribute

Abierto
#2,747 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
postgresql, sqlite, typescript

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
2.9k
Forks
157
Merge medio
11 h 42 min
PR fusionados (30 d)
20

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de zenstackhq/zenstack

Todos los issues de zenstackhq/zenstack

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.