jasperweyne / helpless-kiwi

Manage members, create and manage activities, send mails and more
Apache License 2.0
11 stars 7 forks source link

Delete account button Kiwi #363

Closed mattijsgietman closed 1 year ago

mattijsgietman commented 1 year ago

Hi guys,

I'm currently working in this branch: https://github.com/jasperweyne/helpless-kiwi/tree/Remove_Local_User

I currently keep running into the problem when deleting a user.

SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (kiwi2.kiwi_recipient, CONSTRAINT FK_2661EF51217BBB47 FOREIGN KEY (person_id) REFERENCES kiwi_local_account (id))

I'm pretty sure that we should be removing the recipient correctly, but it's probably not the case since we still receive this error. Could anyone take a quick look at this?

jasperweyne commented 1 year ago

Hi, looking at the current state of the branch, you're trying to remove database records on the application level. That approach is brittle in my experience, although I'm not directly sure what's causing the issue. I'd recommend to move the logic to the ORM level or the database level, respectively through orphanRemoval or cascade operations.

Also, note that I'm currently finalizing the user import function, which is dependent upon this behavior. Some of this functionality will be incorporated there.

In the future, please ask development-related questions in the Discord channel. That way, the Github issues remains a clear overview of user-related bugs and feature requests. For that reason, I'm closing this issue.