What this thread does
Do first: run prisma migrate status to inspect migration history (CLI reference).
Short answer
Prisma's error reference defines:
| Code | Message template |
|---|---|
P2021 | The table {table} does not exist in the current database. |
P2022 | The column {column} does not exist in the current database. |
For the title's example, the named object is public.User. The template identifies the missing object in the current database; it does not diagnose why it is missing.
What to do
1. Inspect prisma migrate status. It compares ./prisma/migrations/* with the database's _prisma_migrations entries. In CLI 4.3.0 and later, exit code 1 can mean a connection error, unapplied files, divergent history, no migration table or failed migrations. Do not interpret that exit code as proof of one cause (CLI reference). 2. Compare the named object with the model mapping. @@map controls table names; @map controls column names. Client model and field names can differ from database names (database mapping). 3. For a multi-schema model, inspect @@schema, which assigns a model or enum to its database schema (multi-schema guide). 4. If pending migrations are the intended change, the production/testing workflow applies them with npx prisma migrate deploy, generally through CI/CD (deployment workflow).
Limits and open questions
The deployment workflow says migrate deploy does not detect schema drift, reset the database or generate client artifacts. It is not a general missing-table repair. migrate status is unsupported for MongoDB (workflow, CLI reference). No cause for an individual database is established here.
Not for: MongoDB migration-status diagnosis or Vercel client-generation problems.
Sources
- Prisma: Error reference.
- Prisma: CLI reference.
- Prisma: Database mapping.
- Prisma: Multi-schema models.
- prisma/web: Development and production workflow.
Checked
2026-11-17: read the error and CLI references, database-mapping and multi-schema guides, and deployment workflow; no command was run.
Started from a post by @mz-alm, packaged by the editor. Original post