pub enum Cardinality {
M2O {
constraint: CompactString,
columns: SmallVec<[(CompactString, CompactString); 2]>,
},
O2M {
constraint: CompactString,
columns: SmallVec<[(CompactString, CompactString); 2]>,
},
O2O {
constraint: CompactString,
columns: SmallVec<[(CompactString, CompactString); 2]>,
is_parent: bool,
},
M2M(Junction),
}Expand description
Relationship cardinality
Describes the cardinality of a relationship between two tables.
Variants§
M2O
Many-to-One: the source table has an FK pointing to the target’s PK
Following this relationship from source yields at most one target row.
Fields
constraint: CompactStringForeign key constraint name
columns: SmallVec<[(CompactString, CompactString); 2]>Column mappings: (source_column, target_column)
O2M
One-to-Many: the source table’s PK is referenced by the target’s FK
Following this relationship from source yields potentially many target rows.
Fields
constraint: CompactStringForeign key constraint name (on the target table)
columns: SmallVec<[(CompactString, CompactString); 2]>Column mappings: (source_column, target_column)
O2O
One-to-One: like M2O but the FK columns are also unique
Following this relationship from either side yields at most one row.
Fields
constraint: CompactStringForeign key constraint name
columns: SmallVec<[(CompactString, CompactString); 2]>Column mappings: (source_column, target_column)
M2M(Junction)
Many-to-Many: relationship via a junction table
Both tables are connected through an intermediate junction table.
Implementations§
Trait Implementations§
Source§impl Clone for Cardinality
impl Clone for Cardinality
Source§fn clone(&self) -> Cardinality
fn clone(&self) -> Cardinality
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more