Actions111
- Item Actions
- Webhook Actions
- Collection Actions
- File Actions
- Activity Actions
- Asset Actions
- Authentication Actions
- Extension Actions
- Field Actions
- Folder Actions
- Permission Actions
- Preset Actions
- Relation Actions
- Revision Actions
- Role Actions
- Setting Actions
- User Actions
- Utility Actions
Overview
This node is designed to delete a relation field from a specified collection in a Directus database. In practical terms, it allows users to remove a relationship (such as a foreign key or linked field) between two collections (tables) within their Directus-managed data. This operation is useful when you need to restructure your data model, for example, by removing an association between entities like "books" and "authors".
Example scenarios:
- Removing the "author" relation from the "books" collection if books are no longer associated with authors.
- Cleaning up unused or obsolete relational fields during schema refactoring.
Properties
| Name | Meaning |
|---|---|
| Collection Name | Unique name of the parent collection. Options are dynamically loaded; e.g., "books". |
| Field Name | Name of the field that holds the related primary key (matches the column name in the database). Options depend on the selected collection; e.g., "author". |
Output
The output will be a JSON object reflecting the result of the deletion operation. Typically, this may include:
- Confirmation of successful deletion.
- Details about the affected collection and field.
Example output:
{
"success": true,
"collection": "books",
"field": "author",
"message": "Relation deleted successfully."
}
Note: The exact structure may vary depending on the underlying API response.
Dependencies
- Directus instance: Requires access to a running Directus backend.
- Authentication/API Key: May require valid credentials or API token configured in n8n credentials for Directus.
Troubleshooting
- Invalid Collection or Field: If the specified collection or field does not exist, the node may return an error such as "Collection not found" or "Field not found." Double-check the names and ensure they match your Directus schema.
- Permission Denied: If the API credentials lack sufficient permissions, you might see errors like "Unauthorized" or "Forbidden." Ensure the user has rights to modify schema/relations.
- Relation In Use: Attempting to delete a relation that is still referenced elsewhere may cause errors. Make sure the relation is not required by other parts of your application.