The models involved in the relation must also exist before running this generator.
Creates a new model relation in a LoopBack application.
$ [slc | apic] loopback:relation [options]
Print the generator’s options and usage.
Do not remember prompt answers. Default is false.
Do not automatically install dependencies. Default is false.
The tool will prompt you for:
- Name of the model to create the relationship from.
- Relation type:
- Name of the model to create a relationship with.
- Name for the relation (property name).
Important: The name of the relation must be different than a property it references.
- Custom foreign key (optional)
- Whether a “through” model is required. Repy “Y” to create a HasManyThrough relations.
- Name of the “through” model, if appropriate.
Updates the Model definition JSON files for the models involved in the relation.