[PR #19443] [MERGED] Fixes #19440: Ensure data migrations use the correct database connection #15647

Closed
opened 2025-12-30 00:23:12 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/19443
Author: @jeremystretch
Created: 5/8/2025
Status: Merged
Merged: 5/12/2025
Merged by: @bctiemann

Base: mainHead: 19440-migration-connections


📝 Commits (1)

  • 76aa255 Fixes #19440: Ensure data migrations use the correct database connection

📊 Changes

32 files changed (+196 additions, -130 deletions)

View changed files

📝 netbox/circuits/migrations/0046_charfield_null_choices.py (+4 -3)
📝 netbox/circuits/migrations/0047_circuittermination__termination.py (+4 -3)
📝 netbox/circuits/migrations/0048_circuitterminations_cached_relations.py (+7 -2)
📝 netbox/circuits/migrations/0051_virtualcircuit_group_assignment.py (+2 -1)
📝 netbox/dcim/migrations/0194_charfield_null_choices.py (+43 -42)
📝 netbox/dcim/migrations/0200_populate_mac_addresses.py (+10 -3)
📝 netbox/dcim/migrations/0206_load_module_type_profiles.py (+3 -1)
📝 netbox/extras/migrations/0108_convert_reports_to_scripts.py (+4 -3)
📝 netbox/extras/migrations/0109_script_model.py (+23 -8)
📝 netbox/extras/migrations/0115_convert_dashboard_widgets.py (+2 -3)
📝 netbox/extras/migrations/0116_custom_link_button_color.py (+3 -1)
📝 netbox/extras/migrations/0117_move_objectchange.py (+5 -3)
📝 netbox/extras/migrations/0120_eventrule_event_types.py (+2 -1)
📝 netbox/extras/migrations/0122_charfield_null_choices.py (+2 -1)
📝 netbox/extras/migrations/0123_journalentry_kind_default.py (+3 -1)
📝 netbox/ipam/migrations/0070_vlangroup_vlan_id_ranges.py (+3 -1)
📝 netbox/ipam/migrations/0071_prefix_scope.py (+4 -2)
📝 netbox/ipam/migrations/0072_prefix_cached_relations.py (+3 -2)
📝 netbox/ipam/migrations/0073_charfield_null_choices.py (+3 -2)
📝 netbox/ipam/migrations/0080_populate_service_parent.py (+8 -6)

...and 12 more files

📄 Description

Fixes: #19440

Updates all data migrations beginning with the v4.0 release to call using(), to ensure the schema editor's database connection is employed.

One note: I haven't been able to determine how to enforce this for MPTT rebuild() operations.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/19443 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 5/8/2025 **Status:** ✅ Merged **Merged:** 5/12/2025 **Merged by:** [@bctiemann](https://github.com/bctiemann) **Base:** `main` ← **Head:** `19440-migration-connections` --- ### 📝 Commits (1) - [`76aa255`](https://github.com/netbox-community/netbox/commit/76aa255f0715de19ab09ed6c271a66ac3e1e531a) Fixes #19440: Ensure data migrations use the correct database connection ### 📊 Changes **32 files changed** (+196 additions, -130 deletions) <details> <summary>View changed files</summary> 📝 `netbox/circuits/migrations/0046_charfield_null_choices.py` (+4 -3) 📝 `netbox/circuits/migrations/0047_circuittermination__termination.py` (+4 -3) 📝 `netbox/circuits/migrations/0048_circuitterminations_cached_relations.py` (+7 -2) 📝 `netbox/circuits/migrations/0051_virtualcircuit_group_assignment.py` (+2 -1) 📝 `netbox/dcim/migrations/0194_charfield_null_choices.py` (+43 -42) 📝 `netbox/dcim/migrations/0200_populate_mac_addresses.py` (+10 -3) 📝 `netbox/dcim/migrations/0206_load_module_type_profiles.py` (+3 -1) 📝 `netbox/extras/migrations/0108_convert_reports_to_scripts.py` (+4 -3) 📝 `netbox/extras/migrations/0109_script_model.py` (+23 -8) 📝 `netbox/extras/migrations/0115_convert_dashboard_widgets.py` (+2 -3) 📝 `netbox/extras/migrations/0116_custom_link_button_color.py` (+3 -1) 📝 `netbox/extras/migrations/0117_move_objectchange.py` (+5 -3) 📝 `netbox/extras/migrations/0120_eventrule_event_types.py` (+2 -1) 📝 `netbox/extras/migrations/0122_charfield_null_choices.py` (+2 -1) 📝 `netbox/extras/migrations/0123_journalentry_kind_default.py` (+3 -1) 📝 `netbox/ipam/migrations/0070_vlangroup_vlan_id_ranges.py` (+3 -1) 📝 `netbox/ipam/migrations/0071_prefix_scope.py` (+4 -2) 📝 `netbox/ipam/migrations/0072_prefix_cached_relations.py` (+3 -2) 📝 `netbox/ipam/migrations/0073_charfield_null_choices.py` (+3 -2) 📝 `netbox/ipam/migrations/0080_populate_service_parent.py` (+8 -6) _...and 12 more files_ </details> ### 📄 Description ### Fixes: #19440 Updates all data migrations beginning with the v4.0 release to call `using()`, to ensure the schema editor's database connection is employed. One note: I haven't been able to determine how to enforce this for MPTT `rebuild()` operations. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:23:12 +01:00
adam closed this issue 2025-12-30 00:23:12 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15647