drizzle-team / drizzle-orm

Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅
https://orm.drizzle.team
Apache License 2.0
21.57k stars 490 forks source link

[BUG]: Incorrect type for array column default value #2334

Open Ziothh opened 1 month ago

Ziothh commented 1 month ago

What version of drizzle-orm are you using?

0.30.3

What version of drizzle-kit are you using?

0.20.17

Describe the Bug

When running drizzle-kit push:pgI get this error:

This happens when I have a integer().array().default([]) column. The types allow for a JS array to be passed but it errors when I do. I need to pass sql'ARRAY[]::integer[]' instead.

> drizzle-kit push:pg

drizzle-kit: v0.20.17
drizzle-orm: v0.30.3

No config path provided, using default path
Reading config file '/Users/zioth/funkey/monorepo/feature/I1034-Bizz-Activity_Selection/apps/api/drizzle.config.ts'
error: syntax error at or near "NOT"
    at /Users/zioth/funkey/monorepo/feature/I1034-Bizz-Activity_Selection/node_modules/drizzle-kit/bin.cjs:43518:21
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async PgPostgres.query (/Users/zioth/funkey/monorepo/feature/I1034-Bizz-Activity_Selection/node_modules/drizzle-kit/bin.cjs:62584:21)
    at async Command.<anonymous> (/Users/zioth/funkey/monorepo/feature/I1034-Bizz-Activity_Selection/node_modules/drizzle-kit/bin.cjs:66267:9) {
  length: 94,
  severity: 'ERROR',
  code: '42601',
  detail: undefined,
  hint: undefined,
  position: '1214',
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'scan.l',
  line: '1241',
  routine: 'scanner_yyerror'
}

Expected behavior

No response

Environment & setup

No response