* fix(users): delete a user who has play sessions on a device
On MariaDB, deleting a user whose play sessions name a device failed with
error 1452 once play_sessions had been rebuilt, as restoring a dump does.
The cascade clears device_id on rows of the user being deleted, and InnoDB
rechecks their user through the index that also holds device_id. The user's
devices are now deleted first, while the user still exists.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(users): force the play_sessions rebuild in the delete-user test
OPTIMIZE TABLE can defragment instead of rebuilding when innodb_defragment
is on (MariaDB 10.11), which would leave the index order unchanged.
ALTER TABLE ... FORCE always rebuilds. Addresses Greptile review.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>