error: type "serial" does not exist
I'm trying to push a generated migration:
ALTER TABLE "account" ALTER COLUMN "id" SET DATA TYPE serial;
ALTER TABLE "account" ALTER COLUMN "id" DROP DEFAULT;
ALTER TABLE "user" ALTER COLUMN "id" SET DATA TYPE serial;
ALTER TABLE "user" ALTER COLUMN "id" DROP DEFAULT;
DO $$ BEGIN
...
But getting this error. Any ideas what is happening ?
error: type "serial" does not exist
at /Users/sfs/Devel/eldorato/node_modules/drizzle-kit/bin.cjs:24462:21
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async PgPostgres.query (/Users/sfs/Devel/eldorato/node_modules/drizzle-kit/bin.cjs:25423:21)
at async Command.<anonymous> (/Users/sfs/Devel/eldorato/node_modules/drizzle-kit/bin.cjs:63260: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'
I found a reference to this might be a problem for the ALTER statement?
![No description](https://cdn.answeroverflow.com/1200394708728422440/image.png)
1 Reply
If I run the sql directly on the postgres 14 I have running, it works fine
This was my own fault, I had forgotten that I needed to run the initial migration before any pushes would succeed.