[PR #20518] [MERGED] Fixes #20290: Avoid exceptions when upgrading to v4.4 from early releases due to missing ObjectTypes table #15950

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20518
Author: @jeremystretch
Created: 10/6/2025
Status: Merged
Merged: 10/8/2025
Merged by: @jeremystretch

Base: mainHead: 20290-handle-missing-objecttype-table


📝 Commits (1)

  • 61b7e08 Fixes #20290: Avoid exceptions when upgrading to v4.4 from early releases due to missing ObjectTypes table

📊 Changes

2 files changed (+17 additions, -4 deletions)

View changed files

📝 netbox/core/models/object_types.py (+9 -1)
📝 netbox/netbox/models/features.py (+8 -3)

📄 Description

Fixes: #20290

This PR is submitted as an alternative to #20473.

  • Hook into ObjectType.objects.get_for_model() to fall back to using the ContentType manager method in event the ObjectType database table does not yet exist. (This should only ever happen during a migration to v4.4.)
  • The has_feature() utility function now support resolving feature support for ContentTypes without querying its corresponding ObjectType in the database.

🔄 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/20518 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 10/6/2025 **Status:** ✅ Merged **Merged:** 10/8/2025 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `main` ← **Head:** `20290-handle-missing-objecttype-table` --- ### 📝 Commits (1) - [`61b7e08`](https://github.com/netbox-community/netbox/commit/61b7e08dd209774a3f9e04c269d182db0da75522) Fixes #20290: Avoid exceptions when upgrading to v4.4 from early releases due to missing ObjectTypes table ### 📊 Changes **2 files changed** (+17 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `netbox/core/models/object_types.py` (+9 -1) 📝 `netbox/netbox/models/features.py` (+8 -3) </details> ### 📄 Description ### Fixes: #20290 This PR is submitted as an alternative to #20473. - Hook into `ObjectType.objects.get_for_model()` to fall back to using the ContentType manager method in event the ObjectType database table does not yet exist. (This should only ever happen during a migration to v4.4.) - The `has_feature()` utility function now support resolving feature support for ContentTypes without querying its corresponding ObjectType in the database. --- <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:24:58 +01:00
adam closed this issue 2025-12-30 00:24:58 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15950