Closed Bug 836288 Opened 11 years ago Closed 11 years ago

Change FK on_delete behavior for Forum.last_post and Thread.last_post

Categories

(support.mozilla.org :: Forum, task, P1)

Tracking

(Not tracked)

RESOLVED FIXED
2013Q1

People

(Reporter: rrosario, Assigned: rrosario)

References

Details

(Whiteboard: u=dev c=forums p=1 s=2013.2)

We've had this bug that keeps coming back to bite us. Basically, if you delete a user you end up deleting all the user's content. That is good. The problem is we have this last_post field on Forum and Thread that is a FK to the post. If you end up deleting that post the delete cascades and takes the forum with it.

Django now supports better behavior:
https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey.on_delete

Those FK are nullable so let's just set on_delete to SET_NULL.
Deployed just now.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.