civitai
civitai copied to clipboard
[Bug]: DB error when uploading image in post
What happened?
prisma:query INSERT INTO "public"."Image" ("name","url","userId","createdAt","updatedAt","meta","hash","height","width","type","metadata","nsfw","nsfwLevel","nsfwLevelLocked","tosViolation","generationProcess","postId","hideMeta","index","mimeType","ingestion") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,CAST($10::text AS "public"."MediaType"),$11,CAST($12::text AS "public"."NsfwLevel"),$13,$14,$15,$16,$17,$18,$19,$20,CAST($21::text AS "public"."ImageIngestionStatus")) RETURNING "public"."Image"."id"
prisma:error
Invalid prisma.image.create()
invocation:
The column createdAt
does not exist in the current database.
❌ tRPC failed on post.addImage
TRPCError:
Invalid prisma.image.create()
invocation:
The column createdAt
does not exist in the current database.
at throwDbError (webpack-internal:///(api)/./src/server/utils/errorHandling.ts:67:121)
at addPostImageHandler (webpack-internal:///(api)/./src/server/controllers/post.controller.ts:215:93)
at async resolveMiddleware (file:///Users/appypie/Documents/civitai/node_modules/@trpc/server/dist/index.mjs:421:30)
... 2 lines matching cause stack trace ...
at async callRecursive (file:///Users/appypie/Documents/civitai/node_modules/@trpc/server/dist/index.mjs:451:32)
at async callRecursive (file:///Users/appypie/Documents/civitai/node_modules/@trpc/server/dist/index.mjs:451:32)
at async callRecursive (file:///Users/appypie/Documents/civitai/node_modules/@trpc/server/dist/index.mjs:451:32)
at async eval (webpack-internal:///(api)/./src/server/trpc.ts:77:20)
at async callRecursive (file:///Users/appypie/Documents/civitai/node_modules/@trpc/server/dist/index.mjs:451:32) {
code: 'INTERNAL_SERVER_ERROR',
[cause]: PrismaClientKnownRequestError:
Invalid prisma.image.create()
invocation:
The column createdAt
does not exist in the current database.
at ai.handleRequestError (/Users/appypie/Documents/civitai/node_modules/@prisma/client/runtime/library.js:126:6775)
at ai.handleAndLogRequestError (/Users/appypie/Documents/civitai/node_modules/@prisma/client/runtime/library.js:126:6109)
at ai.request (/Users/appypie/Documents/civitai/node_modules/@prisma/client/runtime/library.js:126:5817)
at async l (/Users/appypie/Documents/civitai/node_modules/@prisma/client/runtime/library.js:131:9709)
at async addPostImage (webpack-internal:///(api)/./src/server/services/post.service.ts:603:27)
at async addPostImageHandler (webpack-internal:///(api)/./src/server/controllers/post.controller.ts:209:16)
at async resolveMiddleware (file:///Users/appypie/Documents/civitai/node_modules/@trpc/server/dist/index.mjs:421:30)
at async callRecursive (file:///Users/appypie/Documents/civitai/node_modules/@trpc/server/dist/index.mjs:451:32)
at async callRecursive (file:///Users/appypie/Documents/civitai/node_modules/@trpc/server/dist/index.mjs:451:32)
at async callRecursive (file:///Users/appypie/Documents/civitai/node_modules/@trpc/server/dist/index.mjs:451:32) {
code: 'P2022',
clientVersion: '5.9.1',
meta: { modelName: 'Image', column: 'createdAt' }
}
}
I accessed the Image db through psql postgresql://modelshare:postgres@localhost:5432/postgres command and checked the schema in the schema createdAt column is present so I don't know how to resolve it.
Steps to reproduce the problem
- follow the flow mentioned in Readme file.
- change env variable and add S3 variables for image upload.
- run programmability files using prisma-prepare-programmability.mjs file (I excluded running nsfw_level_update_triggers.sql as it was giving some error).
- Still in my db in UserRank few columns were missing which I added manually.
- then when I upload image in posts this error is being showed.
am I missing out something in setup?
What should have happened?
the image data should be entered into "Image" table after I upload image and post it
What platforms do you use to access the site?
MacOS
What browsers do you use to access the site?
Apple Safari
Additional information, context and logs
No response
I got the same issue but now it has fixed to add createdAt in "ImageMetric" Table