dmb
dmb
DTDrizzle Team
Created by dmb on 7/11/2024 in #help
Unable to rename table
I'm attempting to rename ironclad_account_kills to ironclad_account_npc but I'm unable to. What might be causing this?
error: relation "ironclad_account_npc" does not exist
at /Users/dexter/projects/next/progress.quest/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:43530: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:62596:21)
at async pgSuggestions (/Users/dexter/projects/next/progress.quest/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:64890:19)
at async Command.<anonymous> (/Users/dexter/projects/next/progress.quest/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:66233:11) {
length: 119,
severity: 'ERROR',
code: '42P01',
detail: undefined,
hint: undefined,
position: '31',
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'parse_relation.c',
line: '1449',
routine: 'parserOpenTable'
}
error: relation "ironclad_account_npc" does not exist
at /Users/dexter/projects/next/progress.quest/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:43530: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:62596:21)
at async pgSuggestions (/Users/dexter/projects/next/progress.quest/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:64890:19)
at async Command.<anonymous> (/Users/dexter/projects/next/progress.quest/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:66233:11) {
length: 119,
severity: 'ERROR',
code: '42P01',
detail: undefined,
hint: undefined,
position: '31',
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'parse_relation.c',
line: '1449',
routine: 'parserOpenTable'
}
4 replies
DTDrizzle Team
Created by dmb on 4/26/2024 in #help
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?
1 replies