Skip to content

Commit

Permalink
Merge pull request #16238 from craftcms/bugfix/16230-delete-section-p…
Browse files Browse the repository at this point in the history
…gsql

join entries and elements on id when deleting a section
  • Loading branch information
brandonkelly authored Dec 2, 2024
2 parents cf41c5f + 39ceb25 commit 4b18a24
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/services/Entries.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(<<<SQL
UPDATE $elementsTable [[elements]]
SET [[dateDeleted]] = '$now'
FROM $entriesTable [[entries]]
WHERE $conditionSql
WHERE [[entries.id]] = [[elements.id]] AND $conditionSql
SQL)->execute();
}

Expand Down

0 comments on commit 4b18a24

Please sign in to comment.