ALTER TABLE "table" ALTER COLUMN "col" SET DEFAULT ;--> statement-breakpoint
Run drizzle-kit migrate - postgres invalid syntax error.
Expected behavior
Expected SQL in migration file:
ALTER TABLE "table" ALTER COLUMN "col" SET DEFAULT ARRAY[]::varchar(64)[];--> statement-breakpoint
OR it would be nice if drizzle-kit generate could return an error saying the schema is invalid, instead of succeeding. The type inference for default says it accepts a string[] | SQL<unknown> , so passing [] seems intuitive.
Environment & setup
Inside a devcontainer running the mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm Docker image
What version of
drizzle-orm
are you using?0.30.10
What version of
drizzle-kit
are you using?0.21.4
Describe the Bug
https://orm.drizzle.team/learn/guides/empty-array-default-value explains the right way to do this, but as someone new to Drizzle it was confusing that
drizzle-kit generate
acceptsdefault([])
but ends up generating invalid SQL.Schema before:
Schema after:
Run
drizzle-kit generate
- succeeds.Got SQL in migration file:
Run
drizzle-kit migrate
- postgres invalid syntax error.Expected behavior
Expected SQL in migration file:
OR it would be nice if
drizzle-kit generate
could return an error saying the schema is invalid, instead of succeeding. The type inference fordefault
says it accepts astring[] | SQL<unknown>
, so passing[]
seems intuitive.Environment & setup
Inside a devcontainer running the
mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm
Docker image