Fix foreign key constraint violation during ycom addon uninstall
This PR fixes a foreign key constraint violation that prevents the ycom addon from being uninstalled properly.
Problem
When attempting to uninstall the ycom addon, users encounter this error:
SQL error: Error while executing statement "DROP TABLE `rex_ycom_user`" using params []!
SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails
Root Cause
The auth plugin creates a rex_ycom_user_token table with a foreign key constraint to rex_ycom_user:
-
rex_ycom_user_token.user_id→rex_ycom_user.id(CASCADE) -
rex_ycom_user_session.user_id→rex_ycom_user.id(CASCADE)
However, the auth plugin lacks an uninstall.php script, so the rex_ycom_user_token table is never cleaned up during addon uninstallation. When the main uninstall script tries to drop rex_ycom_user, MySQL/MariaDB prevents it due to the existing foreign key constraints.
Solution
This fix adds the missing cleanup for the rex_ycom_user_token table to the main uninstall.php script and ensures proper table dropping order:
- Clean up YForm metadata for both
rex_ycom_userandrex_ycom_user_tokentables - Remove article columns
- Drop dependent tables first:
rex_ycom_user_sessionandrex_ycom_user_token - Finally drop
rex_ycom_usertable safely
The changes are minimal and surgical - only adding the missing table cleanup without modifying any existing logic or removing working code.
Fixes #519.
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1
- Triggering command:
/usr/bin/php8.3 -n -c /tmp/XiKpia /usr/bin/composer install --dev(http block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.