Convert all optional choice fields to use a null empty value #17761
Labels
complexity: medium
Requires a substantial but not unusual amount of effort to implement
netbox
status: accepted
This issue has been accepted for implementation
type: feature
Introduction of new functionality to the application
Milestone
NetBox version
v4.1.3
Feature type
Change to existing functionality
Triage priority
N/A
Proposed functionality
Several models include optional choices fields, such as
Cable.type
. Most (if not all) of these store an empty value as an empty string (''
) rather thannull
. This FR proposes:null
null
for these fieldsThe list of specific fields to be updated is TBD, but is expect to include any CharField for which
choices
is defined andnull
is False.Use case
The use of empty strings to represent empty values for these fields deviates from other fields (e.g. integer-based fields) and complicates the logic needed to achieve complex filtering (see #17575 for an example). This change will help us standardize the behavior of the data model in general.
Database changes
All CharFields which define a set of choices will be modified to store empty values as
null
in the database. Migrations will be included to effect this change on existing data.External dependencies
N/A
The text was updated successfully, but these errors were encountered: