diff --git a/CHANGELOG.md b/CHANGELOG.md index d7582635994..8f3571f5936 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Fixed a bug where sortable checkbox selects were displaying menu buttons even when only one option was selected. ([#16213](https://github.com/craftcms/cms/issues/16213)) - Fixed a bug where it wasn’t possible to sort embedded element indexes by custom fields. - Fixed a bug where changes to nested elements weren’t getting saved to a draft of the parent, if the element editor was triggered via the “Edit” action menu item. ([#16251](https://github.com/craftcms/cms/issues/16251)) +- Fixed a bug where all elements would get soft-deleted when deleting a section on PostgreSQL. ([#16230](https://github.com/craftcms/cms/issues/16230)) ## 5.5.3 - 2024-11-22 diff --git a/src/services/Entries.php b/src/services/Entries.php index 2b6171dff9c..cb472f5ed07 100644 --- a/src/services/Entries.php +++ b/src/services/Entries.php @@ -1144,13 +1144,13 @@ public function handleDeletedSection(ConfigEvent $event): void UPDATE $entriesTable [[entries]] SET [[deletedWithSection]] = TRUE FROM $elementsTable [[elements]] -WHERE $conditionSql +WHERE [[entries.id]] = [[elements.id]] AND $conditionSql SQL)->execute(); $db->createCommand(<<execute(); }