-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Labels
severity: mediumResults in substantial degraded or broken functionality for specfic workflowsResults in substantial degraded or broken functionality for specfic workflowsstatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application
Milestone
Description
Deployment Type
Self-hosted
NetBox Version
v4.3.0
Python Version
3.10
Steps to Reproduce
This issue affects certain schema migrations within NetBox which manipulate data within the database. Some of the affected migrations are:
dcim/0206_load_module_type_profilesipam/0080_populate_service_parentstenancy/0018_contact_group
The migrations may not function correctly if applied to a non-default database (i.e. manage.py migrate --database foo). This hasn't surfaced as an issue to date, but presents a concern now that support for external databases has been added in NetBox v4.3.0 under #18780.
Expected Behavior
ORM queries made within the context of a migration should always explicitly reference the connection provided by the schema editor. For example:
def migrate_contact_groups(apps, schema_editor):
Contact = apps.get_model('tenancy', 'Contact')
Contact.objects.using(schema_editor.connection.alias).update(...)Observed Behavior
These queries are being executed without specifying a connection, which results in utilizing the default database.
def migrate_contact_groups(apps, schema_editor):
Contact = apps.get_model('tenancy', 'Contact')
Contact.objects.update(...)Metadata
Metadata
Assignees
Labels
severity: mediumResults in substantial degraded or broken functionality for specfic workflowsResults in substantial degraded or broken functionality for specfic workflowsstatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application