Skip to content

IntegrityError when deleting a CO that is referenced by another CO #283

@mrmrcoleman

Description

@mrmrcoleman

Plugin Version

0.4.1

NetBox Version

4.4.5

Python Version

Python 3.12.3

Steps to Reproduce

  • Create COT B
  • Create COT A
  • Add COTF (Object) to COT A that points to COT B
  • Create a CO (type B)
  • Create a CO (type A) that point to CO (type B)
  • Delete CO (type B)

Expected Behavior

My assumption that we are using on_delete = CASCADE so I would expect to be warned that deleting the CO (type B) would also delete the CO (type A)

Observed Behaviour

<class 'django.db.utils.IntegrityError'>

update or delete on table "custom_objects_1" violates foreign key constraint "custom_objects_2_relation_id_4e48eab4_fk_custom_objects_1_id" on table "custom_objects_2"
DETAIL:  Key (id)=(1) is still referenced from table "custom_objects_2".

Python version: 3.12.3
NetBox version: 4.4.5-Docker-3.4.2
Plugins: 
  netbox_branching: 0.7.2
  netbox_changes: 0.4.0
  netbox_custom_objects: 0.4.1

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions