chore(directus): update production schema snapshot - #251
chore(directus): update production schema snapshot#251github-actions[bot] wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot could not run the full agentic suite for this review because it was automatically requested on a bot-authored pull request. Request a review from Copilot under Reviewers to retry with the full agentic suite. Improved support for bot-authored pull requests is coming soon.
This PR updates the Directus CMS schema to introduce/expand support for ticket invoice documents and reorganize the ticketing collections accordingly.
Changes:
- Adds/rewires the
ticket_invoicescollection configuration and fields (invoice metadata, file, related invoice linking, snapshot). - Reorders/updates
ticket_ordersandticketscollection metadata to match the new ticketing model and UI grouping/sorting. - Updates relationships/constraints between orders, invoices, tickets, and files.
Suppressed comments (5)
directus-cms/schema.json:1
archive_app_filteris enabled whilearchive_field/archive_valueare null. In Directus this configuration is internally inconsistent and can lead to incorrect/undefined “archived” filtering behavior in the App. Either disablearchive_app_filterforticket_invoicesor configure a proper archive field/value pair.
directus-cms/schema.json:1- The field name
orderis a SQL reserved keyword and can cause quoting/compatibility issues in queries, migrations, or tooling. Prefer renaming this column to something unambiguous likeorder_id/ticket_orderand update the corresponding relation + templates accordingly.
directus-cms/schema.json:1 - The relation metadata says
one_deselect_action: "nullify", but the FK is configured ason_delete: "NO ACTION"(and theorderfield is marked required / non-nullable elsewhere). These settings conflict: “nullify” isn’t possible if deletes are restricted and/or the FK can’t be set to null. Align the three pieces (Directus meta action, DBon_delete, and column nullability) so they represent the same behavior (e.g., restrict deletes + removenullify, or allow nullification by making the column nullable and usingSET NULL).
directus-cms/schema.json:1 invoice_numberis markedrequired: trueandreadonly: truein the Directus meta. Unless this field is always populated automatically (e.g., via Flow/Hook/API-only creation), this can block creating invoices via the Directus App because users can’t enter a required value. If invoices are system-generated, consider also making creation in the App impossible/hidden (or document the automation), or relax eitherrequiredorreadonlyto match the intended operational workflow.
directus-cms/schema.json:1- The
typefield is markedsearchable: truebut is not indexed (is_indexed: false). If the invoices table grows and the UI/API commonly filters bytype, this can become a frequent sequential scan. Consider adding an index onticket_invoices.typeif filtering/sorting by document type is expected to be common.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
💡 Codex Review
https://github.com/programmierbar/website/blob/1383eea7d8a29b111563039f35d844903a01da4c/directus-cms/schema.json#L37452-L37453
Restore the invoice creator foreign key
When this snapshot is applied, ticket_invoices.user_created is now defined as a bare UUID, and the snapshot's relations array has no corresponding relation to directus_users. The invoice correction/cancellation flow relies on this field to retain the acting administrator, so invalid or deleted user IDs can orphan that audit attribution and Directus cannot expose it as a real relation. Preserve the foreign key and add the corresponding relation before accepting this production drift.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
1383eea to
1b78d2d
Compare
| "collection": "ticket_invoices", | ||
| "field": "sent_at", | ||
| "type": "timestamp", | ||
| "meta": { | ||
| "collection": "ticket_orders", | ||
| "collection": "ticket_invoices", | ||
| "conditions": null, | ||
| "display": "raw", | ||
| "display_options": null, | ||
| "field": "company_name", | ||
| "display": "datetime", | ||
| "display_options": { | ||
| "relative": true | ||
| }, | ||
| "field": "sent_at", | ||
| "group": null, | ||
| "hidden": false, | ||
| "interface": "input", | ||
| "note": "Company name (for company purchases)", | ||
| "interface": "datetime", | ||
| "note": "When this document was sent to the customer — set automatically for the confirmation email; once set, the document counts as issued and becomes immutable", | ||
| "options": null, | ||
| "readonly": false, | ||
| "required": false, | ||
| "searchable": true, |
1b78d2d to
db91bab
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
Suppressed comments (1)
directus-cms/schema.json:37333
ticket_invoices.sent_atis described as making the document “issued and immutable once set”, but the field is not marked readonly in the schema metadata. If this immutability should be enforced in the admin UI, setreadonly: true(and/or enforce via permissions/hooks).
| "one_collection": "ticket_orders", | ||
| "one_collection_field": null, | ||
| "one_deselect_action": "nullify", | ||
| "one_field": null, | ||
| "one_field": "invoices", | ||
| "sort_field": null |
| "interface": "list-o2m", | ||
| "note": "Invoice documents issued for this order", | ||
| "options": { | ||
| "template": "{{invoice_number}} ({{type}})", | ||
| "enableCreate": false | ||
| "enableCreate": false, | ||
| "template": "{{invoice_number}} ({{type}})" |
db91bab to
0d08c2d
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The snapshot includes potentially impactful schema drift (notably FK ON DELETE behavior and immutability-related metadata) that should be confirmed/adjusted in production before committing as the new baseline.
Review details
Suppressed comments (3)
directus-cms/schema.json:44572
- The
ticket_invoices.orderforeign key is configured withon_delete: NO ACTIONwhile theorderfield is non-nullable. That means deleting aticket_ordersrecord will fail (or require manually deleting/migrating invoices first), which can complicate cleanup and operational workflows. If invoices should be removed with their order, useON DELETE CASCADE; if orders can be deleted while invoices remain, consider makingordernullable and usingON DELETE SET NULL.
directus-cms/schema.json:37333 ticket_invoices.sent_athas a note stating the document becomes immutable once set, but the field itself is not marked as readonly in the schema metadata (readonly: false). If immutability is intended to be enforced at the Directus layer (UI/API), this should be readonly (and potentially further constrained server-side) to prevent edits after issuance.
directus-cms/schema.json:44655- Both
ticket_ordersandticket_invoiceshave aninvoice_filerelationship todirectus_files(see alsoticket_invoices.invoice_filearound lines 44576-44598). If the newticket_invoicescollection is meant to be the canonical source of invoice PDFs, keepingticket_orders.invoice_filecan lead to ambiguity and inconsistent reads/writes; consider deprecating/hiding/removing the order-level field once migration is complete.
- Files reviewed: 1/1 changed files
- Comments generated: 0 new
- Review effort level: Lite
Automated update of
directus-cms/schema.jsonfrom the production/schema/snapshotendpoint. Review the diff for unexpected schema driftbefore merging.
Triggered by the Update Directus schema snapshot workflow.