Skip to content

[BUG]: error: type "serial" does not exist #2183

@nickrmurphy

Description

@nickrmurphy

What version of drizzle-orm are you using?

0.30.8

What version of drizzle-kit are you using?

0.20.16

Describe the Bug

After generating a migration with drizzle-kit, running drizzle-kit push:pg results in error: type "serial" does not exist

Schema:

export const someEntities = pgTable("some_entity", {
    id: serial("id").primaryKey(),
    name: text("name").notNull(),
    userId: text("userId").notNull().references(() => users.id),
})

Migration:

ALTER TABLE "some_entity" ALTER COLUMN "id" SET DATA TYPE serial;

Full error:

error: type "serial" does not exist
    at /Users/xxx/Code/xxx/node_modules/drizzle-kit/bin.cjs:43518:21
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async PgPostgres.query (/Users/xxx/Code/xxx/node_modules/drizzle-kit/bin.cjs:62439:21)
    at async Command.<anonymous> (/Users/xxx/Code/xxx/node_modules/drizzle-kit/bin.cjs:66122:9) {
  length: 89,
  severity: 'ERROR',
  code: '42704',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'parse_type.c',
  line: '270',
  routine: 'typenameType'
}

Expected behavior

Expect migration to be run and table alteration to complete successfully.

Environment & setup

macOS 14.4.1
Vercel Postgres: PostgreSQL 15
@vercel/postgres: 0.8.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions