Skip to content

Commit 678e24c

Browse files
authored
Fixed order of deletion. (#5)
1 parent b7eeae6 commit 678e24c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/NodeTrait.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,9 @@ public static function bootNodeTrait()
4949

5050
static::deleting(function ($model) {
5151
// We will need fresh data to delete node safely
52+
// We must delete the descendants BEFORE we delete the actual
53+
// album to avoid failing FOREIGN key constraints.
5254
$model->refreshNode();
53-
});
54-
55-
static::deleted(function ($model) {
5655
$model->deleteDescendants();
5756
});
5857

0 commit comments

Comments
 (0)