P2022 : The column `colonne` does not exist in the current database.
The column is probably named 'colonne' because I'm French, but at no point in my code do I have a column named 'colonne'
I've pushed, generated, dropped all, reset, and migrated countless times.
"prisma": "^6.8.2",
3 Replies
Skipping coffee for instant knowledge! Let's brew that AI answer now.
The P2022 error, "The column
If you renamed, added, or removed columns directly in the database (outside of Prisma migrations), Prisma might still expect the old column. Running
After any schema change, always run: to regenerate the client. 3. Column Name Mapping
If you use
If you use
Especially with non-English column names, encoding or case mismatches can cause Prisma to not find the column, even if it exists. Check your database directly for the exact column name and encoding. If you have tried all of the above and the issue persists, please check for any manual changes in your database or share your Prisma schema and migration history for further troubleshooting. References:
- Prisma error code P2022 docs - Similar issue after renaming columns - Schema drift and migration issues š¤ Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly. In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.
colonne
does not exist in the current database," means Prisma is trying to access a column named colonne, but your database does not have this column. This can happen even if you don't see colonne in your Prisma schema or code, often due to schema drift or a mismatch between your Prisma schema and the actual database structure.
Based on similar issues, here are some possible causes and solutions:
1. Schema Drift or Migration IssuesIf you renamed, added, or removed columns directly in the database (outside of Prisma migrations), Prisma might still expect the old column. Running
prisma db pull
only updates your schema, not the actual database structure. Make sure your database and Prisma schema are in sync. Try running:
This will reset your database and apply all migrations from scratch. Be aware: this deletes all data.
2. Stale Prisma ClientAfter any schema change, always run: to regenerate the client. 3. Column Name Mapping
If you use
@map("colonne")
in your Prisma schema, Prisma will look for colonne in the database, even if your model field is named differently. Double-check your schema for any @map
or @@map
attributes.
4. Database Not UpdatedIf you use
prisma db push
or migrations, but the database is not actually updated (e.g., wrong database URL, permissions), Prisma will still expect the new structure. Double-check your connection and migration logs.
5. Case Sensitivity or EncodingEspecially with non-English column names, encoding or case mismatches can cause Prisma to not find the column, even if it exists. Check your database directly for the exact column name and encoding. If you have tried all of the above and the issue persists, please check for any manual changes in your database or share your Prisma schema and migration history for further troubleshooting. References:
- Prisma error code P2022 docs - Similar issue after renaming columns - Schema drift and migration issues š¤ Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly. In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.
Did you try regenerating your PrismaClient with
npx prisma generate
?Yes, it doesn't work. The problem is that this error could mean anything, and it takes me a lot of time to manually check everything to figure out what's wrong.
But its fixed now thanks ! š«¶