How to access the DMMF after version 6.6.0?
Hi, I had a script I was using that reading from
Prisma.DMMF
, but since the past couple updates, this code path no longer seems accessible... Is there a new way to work with the DMMF? Otherwise it's quite complicated to interact with the structure of your own database for anything...2 Replies
You opted for speed from this bot. Let's conjure up an answer right now!
Based on the knowledge sources, you can still access the DMMF (Data Model Meta Format) in Prisma, though there have been some changes to how it's exposed over time.
As of the latest information available, you can access the DMMF through:
This was confirmed to still work in Prisma 5.11.0 as mentioned in a recent discussion Access to metadata from Prisma Client extension.
However, it's important to note that:
1.
Prisma.dmmf
is considered an undocumented, unstable API that is not reflected in Prisma's semantic versioning strategy, so it may change without notice Reflecting Models.
2. In Prisma 4.0.0, they removed Prisma.dmmf.schema
(while keeping Prisma.dmmf.datamodel
) to make the generated client more efficient Upgrading to Prisma 4.
3. For edge runtimes (WASM client), the Prisma.dmmf
property was disabled in Prisma 5.12, though there's an open issue about this Prisma 5.12 client for edge runtime disabled the Prisma.dmmf property.
If you need the schema property or a more stable API, you can use:
For third-party tools, there's an ongoing issue to replace the undocumented Prisma.dmmf
with a public reflection API Replace generated Prisma.dmmf export with public reflection API.ah, that was actually helpful, somewhat.
for anyone interested, this line of code helps tremendously: https://github.com/prisma/prisma/blob/e4208dc0b983120feb89d38fd98bd10d33a32b70/packages/internals/src/get-generators/getGenerators.ts#L161
GitHub
prisma/packages/internals/src/get-generators/getGenerators.ts at e4...
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB - prisma/prisma