DOMjudge / domjudge

DOMjudge programming contest jury system
https://www.domjudge.org
GNU General Public License v2.0
703 stars 249 forks source link

Removing user with submissions fails #2207

Open vmcj opened 8 months ago

vmcj commented 8 months ago

Description of the problem

We get the following error: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (domjudge.judging_run, CONSTRAINTFK_29A6E6E13CBA64F2FOREIGN KEY (judgetaskid) REFERENCESjudgetask(judgetaskid)) when deleting a user which has submissions.

Your environment

Steps to reproduce

Expected behaviour

The user gets deleted, no server errors expected

Actual behaviour

Hanging screen, user is not removed.

meisterT commented 7 months ago

I would argue that deleting a user should not cascade to deleting the team (which then would cascade to deleting their submission and other data). You can have multiple users per team, so deleting one (even if the last one) should probably not cascade at all.

Now for the (same) error that is visible when deleting a team: it probably requires a fix similar to this one: 181ae06a5625611274f7217be85cfd28d5f351b4