Prisma does not recognize Json type even after migrate/generate
Already ran prisma generate and migrate, in my database (postgres) it recognizes descriptor column as Json


4 Replies
Skipping coffee for instant knowledge! Let's brew that AI answer now.
If Prisma does not recognize your
descriptor
column as Json
in your PostgreSQL database even after running prisma migrate
and prisma generate
, there are a few common causes and solutions:
1. Column Type in Database: Prisma will only recognize a column as Json
if its type in PostgreSQL is actually json
or jsonb
. If the column is still of type TEXT
(possibly from a previous Prisma 1 setup), Prisma will map it as String
instead of Json
. You can fix this by manually altering the column type:
After this, run prisma introspect
again. Now, Prisma should recognize the column as Json
in your schemaJson type is represented as TEXT in database.
2. Introspection: When you run prisma introspect
, Prisma maps PostgreSQL json
and jsonb
columns to the Json
type in your Prisma schema. If the column is not recognized, check the actual column type in your databaseType mapping between PostgreSQL and Prisma schema.
3. Schema Caching: Sometimes, your editor or Prisma CLI might cache an old schema. Try restarting your editor and re-running prisma generate
after introspection.
4. Prisma Version: Ensure you are using a recent version of Prisma, as older versions may have bugs or lack full support for JSON typesPrisma Schema Error with Json Type.
If you have confirmed the column is of type json
or jsonb
and Prisma still does not recognize it, please provide the output of prisma introspect
and your current schema.prisma
for further troubleshooting.
ā
Great, thanks for letting us know that this solved your question!Glad to see that the bot was helpful š
I almost clicked that I didnt want to speak to any bot, because it almost never really helps, but that was impressively helpful ; )
That's very good to know š