Phuks-co / throat

Open Source link aggregator and discussion platform powering Phuks
https://phuks.co
MIT License
73 stars 32 forks source link

Drop comment report log entries with invalid rid's #252

Closed happy-river closed 3 years ago

happy-river commented 3 years ago

On our test server we found that we have a few CommentReportLog records whose rid is not a valid index into the SubPostCommentReport table. The foreign key constraint on the rid was broken until recently which permitted the invalid entries to be inserted. I haven't been able to figure out where in current or past versions of the code an invalid rid could be inserted.

Our production database does not contain any invalid rids.

The invalid rids caused the migration from #247 to fail when run on our test server. This change fixes the failing migration by dropping any records from the CommentReportLog table with an invalid rid.