Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

Support for database native type info in DMMF #1069

@idiodoneo-chris

Description

@idiodoneo-chris

Problem

The database type annotations in the Prisma schema, like @db.Uuid, are not being included in the DMMF that is passed to the generators. However, as of the 5.23.0 timeframe, this information is available from the Prisma CLI. It's quite useful for certain custom generators.

Suggested solution

Add this line in class Field in generator/models.py:

native_type: Optional[Tuple[str, List[str]]] = FieldInfo(alias='nativeType', default=None)

Additional context

This does require setting PRISMA_VERSION to 6.0.0 or later to get the native type information, but does not cause problems with the default version of 5.17.0. The native_type field is simply absent. Using 6.0.0 for custom generators appears to cause no issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions