RelationInfo.oneToMany constructor

RelationInfo.oneToMany({
  1. required String name,
  2. required String targetModel,
  3. required String foreignKey,
  4. List<String> references = const ['id'],
  5. String? inverseRelation,
})

Create a one-to-many relation (this model has many of target).

Implementation

factory RelationInfo.oneToMany({
  required String name,
  required String targetModel,
  required String foreignKey,
  List<String> references = const ['id'],
  String? inverseRelation,
}) {
  return RelationInfo(
    name: name,
    type: RelationType.oneToMany,
    targetModel: targetModel,
    foreignKey: foreignKey,
    references: references,
    inverseRelation: inverseRelation,
    isOwner: false, // One side doesn't own FK
  );
}