Module

x/kysely_postgrs_js_dialect/mod.ts>kysely.ColumnDefinitionBuilder#nullsNotDistinct

Kysely dialect for PostgreSQL using the Postgres.js client.
Latest
method kysely.ColumnDefinitionBuilder.prototype.nullsNotDistinct
import { kysely } from "https://dotland.deno.dev/x/kysely_postgrs_js_dialect@v0.27.4/mod.ts";
const { ColumnDefinitionBuilder } = kysely;

Adds nulls not distinct specifier. Should be used with unique constraint.

This only works on some dialects like PostgreSQL.

Examples

db.schema.createTable('person')
 .addColumn('id', 'integer', col => col.primaryKey())
 .addColumn('first_name', 'varchar(30)', col => col.unique().nullsNotDistinct())
 .execute()

The generated SQL (PostgreSQL):

create table "person" (
  "id" integer primary key,
  "first_name" varchar(30) unique nulls not distinct
)