LoopBack 3 has reached end of life. We are no longer accepting pull requests or providing support for community users. The only exception is fixes for critical bugs and security vulnerabilities provided as part of support for IBM API Connect customers. We urge all LoopBack 3 users to migrate their applications to LoopBack 4 as soon as possible. Learn more about LoopBack's long term support policy.

Relation generator

Edit this page
Page Contents
Important: Before running this generator, you must create an application using the application generator. Then you must run the command from the root directory of the application.

The models involved in the relation must also exist before running this generator.

Synopsis

Creates a new model relation in a LoopBack application.

lb relation [options]

With IBM API Connect v5 developer toolkit:

apic loopback:relation [options]

With legacy StrongLoop tools:

$ slc relation [options]

Options

-h, --help
Print the generator’s options and usage.
--skip-cache
Do not remember prompt answers. Default is false.
--skip-install
Do not automatically install dependencies. Default is false.

Interactive Prompts

The tool will prompt you for:

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.

Output

Updates the Model definition JSON files for the models involved in the relation.


AltStyle によって変換されたページ (->オリジナル) /