Defines a directed edge child(fk) -> parent(pk) for rel_schema().
Arguments
- child
Name of the child (referencing) table.
- fk
Character vector of foreign-key column(s) in
child.- parent
Name of the parent (referenced) table.
- pk
Character vector of primary-key column(s) in
parent(defaults tofk).- driver
Logical; if
TRUE, designatesparentas the primary driver table controlling row counts and unit grouping forchildwhenchildhas multiple parents (Star / Fan schemas).- coherent_via
Optional intermediate table name when this edge forms a redundant shortcut in a Diamond FK DAG (
child -> via -> parent).
Examples
rel_fk("admissions", "patient_id", "patients", "patient_id", driver = TRUE)
#> $child
#> [1] "admissions"
#>
#> $fk
#> [1] "patient_id"
#>
#> $parent
#> [1] "patients"
#>
#> $pk
#> [1] "patient_id"
#>
#> $driver
#> [1] TRUE
#>
#> $coherent_via
#> NULL
#>
#> attr(,"class")
#> [1] "flexsynth_fk"