[Django]-Django migration strategy for changing ForeignKey to IntegerField without losing data

3👍

In Django ForeignKey fields store their value in an attribute with _id at the end, which you can access directly to avoid visiting the database.

I would suggest to not change the attribute name, just change target_field = models.ForeignKey to target_field = models.PositiveIntegerField. No data loss.

Leave a comment