Base relation definition type for manifest relations array.

Either targetTable or target must be provided:

  • targetTable: Explicit table name string
  • target: Function returning model reference (tableName derived at runtime)
interface RelationDefinition {
    cardinality?: "one" | "many";
    hasRevisions?: boolean;
    name: string;
    sourceColumn?: string;
    sourceKey?: string;
    target?: () => unknown;
    targetColumn?: string;
    targetKey?: string;
    targetTable?: string;
    through?: {
        sourceColumn?: string;
        sourceForeignKey?: string;
        table: string;
        targetColumn?: string;
        targetForeignKey?: string;
    };
}

Properties

cardinality?: "one" | "many"
hasRevisions?: boolean
name: string
sourceColumn?: string
sourceKey?: string
target?: () => unknown

Lazy model reference. If provided, targetTable is derived from target().tableName

targetColumn?: string
targetKey?: string
targetTable?: string

Target table name. Optional if target is provided (derived at runtime).

through?: {
    sourceColumn?: string;
    sourceForeignKey?: string;
    table: string;
    targetColumn?: string;
    targetForeignKey?: string;
}