From 1529687cc19cb032001d926a48ecf41bce0a0337 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 23 Sep 2026 13:31:16 +0000 Subject: [PATCH] fix(directus): ticket invoice schema follow-up - Add the missing ticket_invoices.user_created -> directus_users FK and relation (ON DELETE NO ACTION, like every other user_created relation in the snapshot), so the acting admin on corrections/cancellations is a real, referentially intact relation. - Make the ticket_orders.invoices O2M read-only in the App: documents must never be detached from their order (the order FK is NOT NULL, so a "nullify" deselect could only fail) or re-linked to another order. - Mark the ticket_orders.invoice_number / invoice_file pointers as read-only with a note: they are still written and read by the bundle (current-document pointer, numbering, backfill) and must not be edited by hand. No fields or data are removed. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01G9qwzY9WrCDrT5NX7zNP1E --- directus-cms/schema.json | 41 ++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/directus-cms/schema.json b/directus-cms/schema.json index faf0677..823aae7 100644 --- a/directus-cms/schema.json +++ b/directus-cms/schema.json @@ -37449,8 +37449,8 @@ "is_generated": false, "generation_expression": null, "has_auto_increment": false, - "foreign_key_table": null, - "foreign_key_column": null + "foreign_key_table": "directus_users", + "foreign_key_column": "id" } }, { @@ -38875,9 +38875,9 @@ "group": null, "hidden": false, "interface": "input", - "note": null, + "note": "Maintained automatically: number of the current invoice document (see Invoices)", "options": null, - "readonly": false, + "readonly": true, "required": false, "searchable": true, "sort": 4, @@ -38919,11 +38919,11 @@ "group": null, "hidden": false, "interface": "file", - "note": null, + "note": "Maintained automatically: PDF of the current invoice document (see Invoices)", "options": { "enableCreate": false }, - "readonly": false, + "readonly": true, "required": false, "searchable": true, "sort": 5, @@ -39044,12 +39044,12 @@ "group": null, "hidden": false, "interface": "list-o2m", - "note": "Invoice documents issued for this order", + "note": "Invoice documents issued for this order — read-only: documents are never detached or deleted; use the invoice actions for corrections and cancellations", "options": { "enableCreate": false, "template": "{{invoice_number}} ({{type}})" }, - "readonly": false, + "readonly": true, "required": false, "searchable": true, "sort": 34, @@ -44622,6 +44622,31 @@ "on_delete": "NO ACTION" } }, + { + "collection": "ticket_invoices", + "field": "user_created", + "related_collection": "directus_users", + "meta": { + "junction_field": null, + "many_collection": "ticket_invoices", + "many_field": "user_created", + "one_allowed_collections": null, + "one_collection": "directus_users", + "one_collection_field": null, + "one_deselect_action": "nullify", + "one_field": null, + "sort_field": null + }, + "schema": { + "table": "ticket_invoices", + "column": "user_created", + "foreign_key_table": "directus_users", + "foreign_key_column": "id", + "constraint_name": "ticket_invoices_user_created_foreign", + "on_update": "NO ACTION", + "on_delete": "NO ACTION" + } + }, { "collection": "ticket_orders", "field": "conference",