netbox-bgp icon indicating copy to clipboard operation
netbox-bgp copied to clipboard

Some objects left after 0.8.1 ASN Migration

Open zombah opened this issue 2 years ago • 3 comments

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:

  1. With netbox-bgp 0.7.x run new ASN migration from web interface
  2. Update netbox-bgp to 0.8.1 run manage.py update procedure
  3. Check errors in log

Expected behavior Some objects left in db after ASN model migration

zombah avatar Sep 19 '22 09:09 zombah

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).

eu-tomas avatar Sep 21 '22 09:09 eu-tomas

Dunno why this happend but manual deletion of all select results from manage.py remove_stale_contenttypes helped to finish manage.py stuff.

zombah avatar Oct 07 '22 16:10 zombah

Thanks @zombah Your info also helped me fix my error.

cyberndj avatar Mar 16 '23 19:03 cyberndj

very old bug - resolving.

cruse1977 avatar May 16 '24 12:05 cruse1977