Skip to main content

CustomFieldType

CustomFieldType

A data type for a custom field. The CustomFieldType determines the data types used in the generated database columns and GraphQL fields as follows (key: m = MySQL, p = Postgres, s = SQLite):

TypeDB typeGraphQL type
stringvarcharString
localeStringvarcharString
textlongtext(m), text(p,s)String
localeTextlongtext(m), text(p,s)String
intintInt
floatdouble precisionFloat
booleantinyint (m), bool (p), boolean (s)Boolean
datetimedatetime (m,s), timestamp (p)DateTime
structjson (m), jsonb (p), text (s)JSON
relationmany-to-one / many-to-many relationAs specified in config

Additionally, the CustomFieldType also dictates which configuration options are available for that custom field.

Signature
type CustomFieldType = | 'string'
| 'localeString'
| 'int'
| 'float'
| 'boolean'
| 'datetime'
| 'relation'
| 'text'
| 'localeText'
| 'struct'