diff --git a/.changeset/forty-birds-wonder.md b/.changeset/forty-birds-wonder.md new file mode 100644 index 0000000000..990b771b0b --- /dev/null +++ b/.changeset/forty-birds-wonder.md @@ -0,0 +1,5 @@ +--- +'directus': patch +--- + +Fixed issue that would prevent collections that had a relationship pointing to them from being deleted. diff --git a/api/src/services/fields.ts b/api/src/services/fields.ts index 22c492c908..4c26146ff0 100644 --- a/api/src/services/fields.ts +++ b/api/src/services/fields.ts @@ -378,7 +378,7 @@ export class FieldsService { // Cleanup directus_fields const metaRow = await trx.select('id').from('directus_fields').where({ collection, field }).first(); - if (metaRow.id) { + if (metaRow?.id) { // Handle recursive FK constraints await trx('directus_fields').update({ group: null }).where({ group: metaRow.id }); }