Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Deleting a show can leave orphaned people #677
Under certain circumstances, deleting a show can leave behind orphaned people records that don't have any shows listed in their profile pages.
Steps to reproduce:
To this end I have added
I think that the
It's not a huge issue and I haven't looked at the code but I imagine that console task essentially scans an entire table in the database and enumerates the person-show relationship which probably isn't great efficiency-wise. Then again it's happening at 3am so...
Just for reference:
It's doing it all through the ORM but it looks like it's getting the list of orphans pretty efficiently (simple left-join SQL query). However the resolution is then done row-by-agonizing-row in a loop; it's sometimes a delete and sometimes an update. This probably could be optimized into just two slightly more complex set-based SQL queries (an update and a delete), with no separate select query beforehand and no php loop, if desired. That would be super quick I think.
But that all said, completely agree that event based action when a show is deleted is probably best.