Wrong drizzle generate with an array of text() in PSQL

I've been trying to create an array of text() using PSQL for ex. when I add the below column, drizzle generates this "custom_selected_rules" text[] DEFAULT NOT NULL but here's the schema definition
customSelectedRules: text("custom_selected_rules")
.array()
.default([])
.notNull()
customSelectedRules: text("custom_selected_rules")
.array()
.default([])
.notNull()
It should be "custom_selected_rules" text[] DEFAULT '{}'::text[] NOT NULL Why Drizzle doesn't do this by default? Thanks!
1 Reply
rphlmr âš¡
rphlmr ⚡•5mo ago
You can force it if you want:
.default(sql`'{}'::text[]`)
.default(sql`'{}'::text[]`)
for the 'why' I don't know 😬. I guess default works better for scalar types