create_relationship
Create relationships between Directus collections—one-to-one, one-to-many, many-to-one, many-to-many, and many-to-any—by specifying source, field, and target. Configure delete/update actions and junction fields for precise data modeling.
Instructions
Create relationships between collections (O2O, O2M, M2O, M2M, M2A)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | Relationship type | |
| field | Yes | Source field | |
| on_delete | No | On delete action | |
| on_update | No | On update action | |
| collection | Yes | Source collection | |
| sort_field | No | Sort field | |
| related_field | No | Target field | |
| junction_field | No | Junction field (M2M only) | |
| collection_field | No | Collection field (M2A only) | |
| primary_key_field | No | Primary key field (M2A only) | |
| related_collection | No | Target collection | |
| allowed_collections | No | Allowed collections (M2A only) | |
| junction_collection | No | Junction collection (M2M only) | |
| related_junction_field | No | Related junction field (M2M only) |