

Unique attributes can be defined on a single field using attribute, or on multiple fields (also called composite or compound unique constraints) using the attribute. You can add unique attributes to your models to be able to uniquely identify individual records of that model. Refer to the attribute function reference documentation for information about connector support for functions. These are available in versions 4.0.0 and later, when using databases where Prisma supports them (PostgreSQL, CockroachDB and MongoDB) Lists of static values, such as ( Int) or ( String).Static values that correspond to the field type, such as 5 ( Int), Hello ( String), or false ( Boolean).For example, cuid() and uuid() are provided by Prisma's query engine for all connectors. Represent DEFAULT values in the underlying database (relational databases only) or.The following example includes a scalar list and a list of related attributes either: Note: You cannot combine type modifiers - optional lists are not supported. The type of a field can be modified by appending either of two modifiers: Control the exact native type that Prisma Migrate creates in the database - for example, a String can be or See an enriched schema when you introspect.See complete list of native database type attributes per scalar type and provider. For example, if you are using the PostgreSQL provider, String fields where the underlying native type is text will not have a type attribute. Prefixed by where db is the name of the datasource block in your schemaįurthermore, during Introspection type attributes are only added to the schema if the underlying native type is not the default type.Specific to the underlying provider - for example, PostgreSQL uses for Boolean whereas MySQL uses Written in PascalCase (for example, VarChar or Text).In the example data model, User, Profile, Post and Category are models.Ī blogging platform can be extended with the following models: Models are represented by model blocks and define a number of fields.

Models represent the entities of your application domain. In this case, the database schema is the single source of truth for the models of your application.

In the above syntax, we have three enumeration values. We can create ENUM columns in MySQL with the help of the following syntax − CREATE TABLE table_name( For creating an ENUM column, the enumeration value must be a quoted string literals.
