Establish a concrete relationship from JobResult to related objects #12068
Labels
status: accepted
This issue has been accepted for implementation
type: feature
Introduction of new functionality to the application
Milestone
NetBox version
v3.4.6
Feature type
Data model extension
Proposed functionality
The JobResult model current has a ForeignKey field to ContentType, which enables associating an instance with a particular type of NetBox model. It also has a
name
field to indicate the object's name, however this is not a concrete relationship in the database. This is due to the limitation of scripts and reports not being tracked as database objects.This FR proposes the additional of an object ID field to complement the object type field, which will enable GenericForeignKey assignments for JobResults. This is possible thanks to the implementation of #11890, which introduces "real" database models representing reports and scripts.
The following changes are proposed for the JobResult model:
obj_type
toobject_type
for consistency with other NetBox models using GFK.object_id
integer field.JobResultsMixin
.We'll keep the
name
field as an optional field: It can be used to differentiate among jobs pertaining to the same object. For example, we can expect a ScriptModule containing multiple scripts to have separate jobs for each script.Use case
Introducing a database relationship between a job and its assigned object enables more robust and efficient correlation and management of jobs. For example, we'll be able to pull all jobs pertaining to a specific script via it's module:
Database changes
No response
External dependencies
No response
The text was updated successfully, but these errors were encountered: