Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nickrmurphy opened this issue Apr 20, 2024 · 14 comments
Open

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

nickrmurphy opened this issue Apr 20, 2024 · 14 comments
Labels
bug Something isn't working db/postgres drizzle/kit priority Will be worked on next

Comments

@nickrmurphy
Copy link

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

@nickrmurphy nickrmurphy added the bug Something isn't working label Apr 20, 2024
@nickrmurphy nickrmurphy changed the title [BUG]: [BUG]: error: type "serial" does not exist Apr 21, 2024
@giribabu22
Copy link

I'm also facing the same issue, @realmikesolo. However, I added the 'drizzle-kit'
.

@blasdfaa
Copy link

same problem

@GStudiosX2
Copy link

GStudiosX2 commented Aug 4, 2024

I also have this issue if you delete the table in the database it then works but you may want the data

@barrynorman
Copy link

i have the same issue

@DevWedeloper
Copy link

I'm facing the same issue.

@giribabu22
Copy link

error: type "serial" does not exist
    at C:\Users\ADMIN\Desktop\my office\zuvy-server\node_modules\pg-pool\index.js:45:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.query (C:\Users\ADMIN\Desktop\my office\zuvy-server\node_modules\drizzle-kit\bin.cjs:71837:26)
    at async pgPush (C:\Users\ADMIN\Desktop\my office\zuvy-server\node_modules\drizzle-kit\bin.cjs:74783:13)
    at async Object.handler (C:\Users\ADMIN\Desktop\my office\zuvy-server\node_modules\drizzle-kit\bin.cjs:83642:9)
    at async run (C:\Users\ADMIN\Desktop\my office\zuvy-server\node_modules\drizzle-kit\bin.cjs:82009:7) {
  length: 89,
  severity: 'ERROR',
  code: '42704','
  detail: undefined,
  hint: undefined,

@timurkhakhalev
Copy link

Any updates here?

@HarjjotSinghh
Copy link

Facing the same issue.

@spacerumsfeld-code
Copy link

Same

@mmikhan
Copy link

mmikhan commented Nov 6, 2024

Same issue here

@kedom1337
Copy link

+1

3 similar comments
@sebmor
Copy link

sebmor commented Nov 14, 2024

+1

@ricjohn-acosta
Copy link

+1

@Friedrich482
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working db/postgres drizzle/kit priority Will be worked on next
Projects
None yet
Development

No branches or pull requests