Custom Type
🔋 ZModel vs Prisma Schema
Custom type is a ZModel concept and doesn't exist in PSL.
Besides models, you can also define custom types to encapsulate complex data structures. The main difference between a model and a custom type is that the latter is not backed by a database table.
Here's a simple example:
type Address {
street String
city String
country String
zip Int
}
Custom types are defined exactly like models, with the exception that they cannot contain fields that are relations to other models. They can, however, contain fields that are other custom types.
There are two ways to use custom types:
type Address {
street String
city String
country String
zip Int
}
type UserProfile {
gender String
address Address?
}