Common Options
Options that apply to all field types.Generated Column
A column that automatically generates computed values.type:STORED|VIRTUALSTORED: Physically stored (can create indexes)VIRTUAL: Calculated only on query (saves memory)
expression: SQL expression
Numeric Types
integer / integer[]
32-bit integer type.- Single Value
- Array
- PostgreSQL:
integer - TypeScript:
number - JSON:
number
bigInteger / bigInteger[]
64-bit integer type.- Single Value
- Array
- PostgreSQL:
bigint - TypeScript:
bigint - JSON:
bigint(serialized as string)
number / number[]
Floating-point or fixed-point numeric type.- Single Value
- Array
- PostgreSQL:
numeric(10, 2)(default) - TypeScript:
number - JSON:
number
precision: Total digits (default: none = unlimited)scale: Decimal places (default: 0)numberType:numeric|real|double precision(default:numeric)
numeric / numeric[]
High-precision numeric type. Processed as string in TypeScript.- Single Value
- Array
- PostgreSQL:
numeric(20, 10) - TypeScript:
string⚠️ - JSON:
string
precision: Total digitsscale: Decimal places
String Types
string / string[]
Variable-length string type.- Single Value
- Array
- PostgreSQL:
varchar(255)(when length specified) ortext - TypeScript:
string - JSON:
string
length: Maximum length (usestexttype when omitted)zodFormat: Zod 4 String Format validation (see below)
zodFormat Option
ThezodFormat option automatically applies Zod’s string format validation when generating BaseSchema.
Usage Example:
enum / enum[]
Enumeration type. Only values defined in the Entity’senums are allowed.
- Single Value
- Array
- PostgreSQL:
text - TypeScript:
"admin" | "normal"(Union of Enum keys) - JSON:
string
id: Enum type ID (must be defined in Entity’senums)length: String max length (optional)
Learn More - Enums - Detailed Enum guide
Boolean Type
boolean / boolean[]
Type for storing true/false values.- Single Value
- Array
- PostgreSQL:
boolean - TypeScript:
boolean - JSON:
boolean
Date/Time Types
date / date[]
Type for storing date and time.- Single Value
- Array
- PostgreSQL:
timestamptz(with timezone) - TypeScript:
Date - JSON:
string(ISO 8601 format)
UUID Type
uuid / uuid[]
Universally Unique Identifier (UUID) type.- Single Value
- Array
- PostgreSQL:
uuid - TypeScript:
string - JSON:
string
UUID Generation: Using PostgreSQL’s
gen_random_uuid() function as dbDefault enables
auto-generation.Structured Data Types
json
Type for storing structured data in JSON format.- PostgreSQL:
json - TypeScript: User-defined type (
ProductMetadata) - JSON:
any
id: TypeScript type ID (defined in.types.ts)
virtual
Virtual fields not stored in the database.- PostgreSQL: Not stored
- TypeScript: User-defined type (or
string,number, etc.) - JSON: Included (after calculation)
id: TypeScript type IDvirtualType:code|query(default:code)code: Calculated with TypeScript codequery: Calculated with SQL appendSelect
- code
- query
Calculated with TypeScript code in Model.Pros: Can implement complex logic, can call external APIs
Cons: Cannot filter/sort at database level
Vector Types
vector / vector[]
Type for storing vector embeddings. Requires pgvector extension.- Single Value
- Array
- PostgreSQL:
vector(1536)(pgvector extension) - TypeScript:
number[] - JSON:
number[]
dimensions: Vector dimensions (required, e.g., 1536)
Learn More - Vector Search - Detailed vector
search guide - pgvector - PostgreSQL vector extension
tsvector
Type for PostgreSQL Full-Text Search.- PostgreSQL:
tsvector - TypeScript:
string - JSON:
string
Full-Text Search: A type optimized for keyword searching in natural language text. Supports
morphological analysis, stemming, etc.
Relation Type
Type for defining relationships with other Entities.BelongsToOne: N:1 relationshipOneToOne: 1:1 relationshipHasMany: 1:N relationshipManyToMany: N:M relationship
Learn More - Relations - Detailed Relation guide
Type Selection Guide
Storing Numbers
Storing Strings
Storing Date/Time
Complex Data
Next Steps
Relations
Define Entity relationships
Enums
Using Enum types
Indexes
Improve search performance with indexes
Vector Search
Setting up Vector search