netbox-bgp
netbox-bgp copied to clipboard
Some objects left after 0.8.1 ASN Migration
NetBox version 3.3.4
Describe the bug Manage.py migrate for version 0.8.1 fails with some objects left in db which reference old ASN model. Error from log:
2022-09-19T12:39:42.977643+03:00 dcim python3[8808]: django.db.models.deletion.ProtectedError: ("Cannot delete some instances of model 'ContentType' because they are referenced through protected foreign keys: 'ObjectChange.changed_object_type'.", {<ObjectChange: asn X updated by Y>, <ObjectChange: asn X created by Y>})
To Reproduce Steps to reproduce the behavior:
- With netbox-bgp 0.7.x run new ASN migration from web interface
- Update netbox-bgp to 0.8.1 run manage.py update procedure
- Check errors in log
Expected behavior Some objects left in db after ASN model migration
This seems to be related to the old plugin AS objects still being referenced from the change log. It looks like those entries need to be either converted to text instead of an object relationship, or deleted (not preferred).
Dunno why this happend but manual deletion of all select results from manage.py remove_stale_contenttypes
helped to finish manage.py stuff.
Thanks @zombah Your info also helped me fix my error.
very old bug - resolving.