Description
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 than null
. This FR proposes:
- Changing the empty value of these fields to
null
- Introducing migrations to replace all empty string values with
null
for these fields
The list of specific fields to be updated is TBD, but is expect to include any CharField for which choices
is defined and null
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