Converting a field from X type to Serial causes errors

I'm attempting to convert a field from type text to type serial. Here's the error I'm seeing:
error: type "serial" does not exist
at /Users/dexter/projects/next/progress.quest/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:24462:21
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async PgPostgres.query (/Users/dexter/projects/next/progress.quest/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:25423:21)
at async Command.<anonymous> (/Users/dexter/projects/next/progress.quest/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:63261: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'
}
error: type "serial" does not exist
at /Users/dexter/projects/next/progress.quest/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:24462:21
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async PgPostgres.query (/Users/dexter/projects/next/progress.quest/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:25423:21)
at async Command.<anonymous> (/Users/dexter/projects/next/progress.quest/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:63261: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'
}
Here's the SQL generated:
ALTER TABLE "api_key" ALTER COLUMN "user_id" SET DATA TYPE serial;--> statement-breakpoint
ALTER TABLE "api_key" ALTER COLUMN "user_id" SET DATA TYPE serial;--> statement-breakpoint
I believe serial to simply be an integer datatype under the hood. So should this in fact be:
ALTER TABLE "api_key" ALTER COLUMN "user_id" SET DATA TYPE integer;--> statement-breakpoint
ALTER TABLE "api_key" ALTER COLUMN "user_id" SET DATA TYPE integer;--> statement-breakpoint
Any thoughts?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server