Empty default array

Im creating text array with empty array as default like this tags: text("tags").array().default([]), but when i do drizzlekit push:pg it gives the following changes but when applying the changes it errors out:
ALTER TABLE "users" ALTER COLUMN "favorites" SET DEFAULT ;
ALTER TABLE "files" ALTER COLUMN "tags" SET DATA TYPE text[];
ALTER TABLE "files" ALTER COLUMN "tags" SET DEFAULT ;
ALTER TABLE "users" ALTER COLUMN "favorites" SET DEFAULT ;
ALTER TABLE "files" ALTER COLUMN "tags" SET DATA TYPE text[];
ALTER TABLE "files" ALTER COLUMN "tags" SET DEFAULT ;
Error: error: syntax error at or near ";" position: 58 (which means at the end of the first query)
3 Replies
piton
pitonOP8mo ago
Bump
Mykhailo
Mykhailo8mo ago
Hello, @piton. This is bug https://github.com/drizzle-team/drizzle-orm/issues/1003 you can update your schema with this
tags1: text('tags1')
.array()
.notNull()
.default(sql`'{}'::text[]`),
// or
tags2: text('tags2')
.array()
.notNull()
.default(sql`ARRAY[]::text[]`),
tags1: text('tags1')
.array()
.notNull()
.default(sql`'{}'::text[]`),
// or
tags2: text('tags2')
.array()
.notNull()
.default(sql`ARRAY[]::text[]`),
GitHub
[BUG]: Default value in array generating wrong migration file · Iss...
What version of drizzle-orm are you using? 0.28.0 What version of drizzle-kit are you using? 0.19.12 Describe the Bug This is my drizzle schema. export const responses = pgTable('responses'...
piton
pitonOP8mo ago
Okay, thanks for letting me know
Want results from more Discord servers?
Add your server