Skip to main content

Interface: Ref

A relationship between columns of two tables (Ref, inline ref:, or one from a TablePartial).

Properties​

color​

color: string | null;

fkSide​

fkSide: "from" | "to" | null;

Which endpoint holds the foreign key: the many side; to for one-to-one (same rule as @dbml/core's SQL exporters); null for many-to-many.


from​

from: RefEndpoint;

Endpoint order as the parser returns it. For inline refs the parser puts the target first.


fromPartial​

fromPartial: string | null;

Set when the ref was synthesised from an inline ref: inside a TablePartial.


id​

id: string;

Stable id derived from both endpoints and the op, also for named refs: ref:<fromTableId>(<cols>)<op><toTableId>(<cols>), plus #<n> only when several refs have the same endpoints and op. See refIdOf / parseRefId.


inactive​

inactive: boolean;

name​

name: string | null;

note​

note: string | null;

onDelete​

onDelete: string | null;

onUpdate​

onUpdate: string | null;

relation​

relation: string;

Relationship operator reconstructed from both cardinalities: >, <, -, <>, ?-, ...


span​

span: SourceSpan;

to​

to: RefEndpoint;