ReadonlyschemaThe underlying schema (relations registered via withExtension('relations', ...)).
Declare a many-to-one relation where the FK lives on THIS table.
Selector of nav property (foreign schema, usually .optional()).
Selector of local-side FK property: l => l.userId
Optionalopts: { optional?: boolean }Declare a many-to-many relation through a pivot table.
Selector of nav array property: t => t.tags
Pivot table config { table, localKey, foreignKey }.
Declare a CTI (Class Table Inheritance) variant. Only valid after
.discriminator(). Returns a new Entity whose schema carries the
updated 'variants' extension.
Discriminator literal (e.g. 'image').
Entity wrapping the variant table schema.
Accessor returning the FK property on the variant schema that joins back to the base PK.
Optionalopts: {{ allowOrphan?: boolean; relations?: ... } — see CTI docs.
Mark this entity as polymorphic by selecting the discriminator
property. Returns a new Entity whose .ctiVariant() /
.stiVariant() methods declare each variant.
Declare ordinary relations (.belongsTo() etc.) on this entity BEFORE
.discriminator(). After .discriminator() you are in the
polymorphic-builder phase: .hasOne/.hasMany/.belongsTo/.belongsToMany
still work, but the per-variant relations live on the .ctiVariant()
/ .stiVariant() calls.
Declare a one-to-many relation where the FK lives on the FOREIGN table.
Selector of nav array property: t => t.posts
Selector of remote-side FK on foreign schema: r => r.userId
Declare a one-to-one relation where the FK lives on the FOREIGN table.
navSel selects the navigation property on THIS schema (must hold the
foreign schema, typically .optional()). The foreign schema is
auto-resolved at runtime from that property; provided explicitly here
via opts.foreign only when peeling fails.
Selector of nav property: t => t.author
Selector of remote-side FK on foreign schema: r => r.userId
Optionalopts: { optional?: boolean }Optional { optional?: boolean } (default false).
Declare an STI (Single Table Inheritance) variant. Only valid after
.discriminator(). Accepts either an Entity or a bare
ObjectSchemaBuilder.
Optionalopts: {
A typed wrapper around an
ObjectSchemaBuilderthat tracks declared relations in itsTRelsgeneric. Use defineEntity to create one.Relations are declared via
.hasOne()/.hasMany()/.belongsTo()/.belongsToMany()on the entity (NOT on the underlying schema). Each call returns a newEntitywhoseTRelsincludes the new relation, soquery(db, entity).include(t => t.assignee)is fully typed.