Skip to content

On delete order was breaked with RESTICT action #20948

@fanshan

Description

@fanshan

NetBox Edition

NetBox Community

NetBox Version

v4.4.7

Python Version

3.12

Steps to Reproduce

Hello,

We create the Netbox Docker plugin and we face a problem on the delete cascade order.

Starting Netbox v4.4.7 in the plugin development context, if we create relations like this on a model Container:

host = models.ForeignKey(Host, on_delete=models.CASCADE, related_name="containers")
image = models.ForeignKey(
    Image, on_delete=models.RESTRICT, related_name="containers"
)

Then create a Host typed object, an Image typed object and a Container typed object linked to previous objects.

Try to delete the Host typed object.

An error IntegrityError at /plugins/docker/hosts/delete/ raise with the content:

null value in column "image_id" of relation "netbox_docker_plugin_container" violates not-null constraint
DETAIL:  Failing row contains (1, test, none, null, 1, null, 2025-12-08 16:04:32.912308+00, 2025-12-08 16:04:57.259281+00, {}, null, create, null, no, {}, null, {}).

Expected Behavior

The Host, Image and Container typed object are deleted.

Observed Behavior

An error IntegrityError at /plugins/docker/hosts/delete/ raise with the content:

null value in column "image_id" of relation "netbox_docker_plugin_container" violates not-null constraint
DETAIL:  Failing row contains (1, test, none, null, 1, null, 2025-12-08 16:04:32.912308+00, 2025-12-08 16:04:57.259281+00, {}, null, create, null, no, {}, null, {}).

Metadata

Metadata

Assignees

No one assigned

    Labels

    netboxstatus: revisions neededThis issue requires additional information to be actionabletype: bugA confirmed report of unexpected behavior in the application

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions