mirror of
https://github.com/directus/directus.git
synced 2026-01-24 07:27:59 -05:00
Fix collection delete for collections w/ m2o to them (#5809)
* Fix new-collection relational field creation * Fix collection delete for collections w/ m2o to them Fixes #5793
This commit is contained in:
5
.changeset/forty-birds-wonder.md
Normal file
5
.changeset/forty-birds-wonder.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'directus': patch
|
||||
---
|
||||
|
||||
Fixed issue that would prevent collections that had a relationship pointing to them from being deleted.
|
||||
@@ -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 });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user