Fixes #7125 and #7069 by implementing a two-step deletion process that avoids MySQL's restriction on deleting from a table while selecting from it in a subquery. The fix separates the SELECT and DELETE operations: 1. First query: Get card IDs for assignments to delete 2. Second query: Delete assignments using the collected IDs This approach works on all supported database systems (MySQL 5.7+, MySQL 8.0+, MariaDB 10.x+) and follows MySQL's official best practices for handling Error 1093: 'You can't specify target table for update in FROM clause'. The issue occurred because the original deleteByParticipantOnBoard method used a subquery that referenced the same table being deleted from, which MySQL prohibits but MariaDB allows (explaining why it worked in development but failed in production). Signed-off-by: Arne Bartelt <arne.bartelt@gmail.com> Signed-off-by: Arne Bartelt <Arne.Bartelt@gmail.com>
960 B
960 B
Authors
- Adrian Missy adrian.missy@onewavestudios.com
- Alexandru Puiu alexpuiu20@yahoo.com
- Arne Bartelt arne.bartelt@gmail.com
- Chandi Langecker git@chandi.it
- Christoph Wurst christoph@winzerhof-wurst.at
- Gary Kim gary@garykim.dev
- Georg Ehrke oc.list@georgehrke.com
- Jakob Röhrl jakob.roehrl@web.de
- Johannes Szeibert johannes@szeibert.de
- John Molakvoæ skjnldsv@protonmail.com
- Julien Veyssier eneiluj@posteo.net
- Julius Härtl jus@bitgrid.net
- Luka Trovic luka.trovic@nextcloud.com
- Maxence Lange maxence@artificial-owl.com
- Michael Weimann mail@michael-weimann.eu
- Raul Ferreira Fuentes raul@nextcloud.com
- Ryan Fletcher ryan.fletcher@codepassion.ca
- Steven R. Baker steven@stevenrbaker.com
- Thanos kamber thanos.kamber@gmail.com
- Vitor Mattos vitor@php.rio