belongsTo relation in Supista ERP
In Supista ERP, a belongsTo
relation establishes a many-to-one connection between two components (tables), where a record in the child table holds a reference to a single record in the parent table.
When a belongsTo
relation is defined:
- A new column (foreign key) is automatically created in the child table.
- This column is used to store the ID of a row from the parent table.
In the Supista UI, this appears as a dropdown field in the child form, allowing the user to select one parent row to associate with the child.
Example Scenario: A Member belongs to a Team
- Parent Table: Teams
- Child Table: Members
- Supista creates a column in Members:
Teams - Members ID
(or similar) - Each Member can be linked to only one Team at a time