Closed denny closed 8 years ago
@denny Is this the same error I get when I try to delete a user which still has posts they own? Such as attempting to delete the demo user "w1n5t0n" without first deleting w1n5t0n's posts?
[error] DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Cannot delete or update a parent row: a foreign key constraint fails ("shac_seascouts_website"."news_item", CONSTRAINT "news_item_fk_author" FOREIGN KEY ("author") REFERENCES "user" ("id")) [for Statement "DELETE FROM user
WHERE ( id
= ? )" with ParamValues: 0='2'] at /home/wbraswell/public_html/shac_seascouts_website-latest/script/../lib/ShinyCMS/Controller/Admin/User.pm line 204
Yeah, there's quite a lot of work that could be done still on either deleting related content when you delete a parent item, or flagging it up for user decision on whether they want to go and delete that stuff.
That said, I thought I'd done the confirmations one. I'll look at it again.
This is still an issue, now it's doing it the IP address logging as well:
FastCGI: server "/tmp/burksdigital.biz.fcgi" stderr: [error] DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Cannot delete or update a parent row: a foreign key constraint fails ("burksdigital_biz"."user_ip_address", CONSTRAINT "user_ip_address_fk_user" FOREIGN KEY ("user") REFERENCES "user" ("id")) [for Statement "DELETE FROM user
WHERE ( id
= ? )" with ParamValues: 0='5'] at /home/wbraswell/public_html/burksdigital.biz-latest/script/../lib/ShinyCMS/Controller/Admin/User.pm line 205, referer: http://burksdigital.biz/admin/user/edit/5
Just pushed a commit which hopefully removes all but the non-trivial user-generated content and associated metadata before attempting to delete a user account. Still need to decide what to do about the non-trivial stuff - blog posts, transaction logs, etc.
Nice, will test on my next Shiny install. :+1:
See title... db constraint sort of fail.