Skip to content

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

@Ziothh

Description

@Ziothh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions