ottlinger / hornherzogen

Project to manage Aikidō seminar registrations
GNU General Public License v3.0
0 stars 2 forks source link

Admin: Deleting an applicant fails if there are roombookings #101

Closed ottlinger closed 7 years ago

ottlinger commented 7 years ago

Currently if trying to remove an applicant with roombookings you will get an PDOException:

Fatal error: Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`database`.`roombooking`, CONSTRAINT `applicant_id_fk` FOREIGN KEY (`applicantId`) REFERENCES `applicants` (`id`) ON DELETE NO ACTION) in /src/hornherzogen/db/ApplicantDatabaseWriter.php:66 Stack trace: #0 /src/hornherzogen/db/ApplicantDatabaseWriter.php(66): PDO->exec('DELETE from `ap...') #1 /admin/db/db_applicants.php(170): hornherzogen\db\ApplicantDatabaseWriter->removeById('25') #2 {main} thrown in /src/hornherzogen/db/ApplicantDatabaseWriter.php on line 66

Workaround: remove room bookings in admin UI first.

Long term solution: remove any bookings if an applicant is to be removed.