drizzle-orm icon indicating copy to clipboard operation
drizzle-orm copied to clipboard

[FEATURE]:Add null as a default value

Open siemah opened this issue 2 years ago • 3 comments

Describe want to want

I tried to add a default value to a column but the default method didn't allow me to add null as a default value, something similar to:

email: varchar("email", { length: 150, }).default(null)

siemah avatar May 01 '23 05:05 siemah

Maybe I'm wrong, but without notNull every value is null by default (on postgres)

rphlmr avatar May 11 '23 13:05 rphlmr

It didn't work for me until i did it manually by editing sql output. this is a packages versions:

    "drizzle-orm": "^0.25.3",
    "drizzle-kit": "^0.17.6-76e73f3"

siemah avatar May 11 '23 19:05 siemah

By default, nullable fields are assigned to null if no data is provided in INSERT statement. There is no point to add null as default because it already is.

lucaspiresfernandes avatar May 26 '23 08:05 lucaspiresfernandes

Should this be closed?

Maybe I'm wrong, but without notNull every value is null by default (on postgres)

This is the current behavior.

Angelelz avatar Aug 14 '23 19:08 Angelelz