From 734a69c9a761d9eaaeb888d4cbd17e4e2e49c73f Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 7 May 2026 11:14:02 -0400 Subject: [PATCH] Closes #22141: Deprecate support for PostgreSQL 14 (#22142) --- docs/configuration/required-parameters.md | 2 +- docs/installation/1-postgresql.md | 3 +++ docs/installation/index.md | 4 ++- docs/installation/upgrading.md | 5 +++- docs/introduction.md | 4 ++- netbox/core/apps.py | 2 +- netbox/core/checks.py | 30 ++++++++++++++++++++++- 7 files changed, 44 insertions(+), 6 deletions(-) diff --git a/docs/configuration/required-parameters.md b/docs/configuration/required-parameters.md index 72573afad..6411fdea7 100644 --- a/docs/configuration/required-parameters.md +++ b/docs/configuration/required-parameters.md @@ -59,7 +59,7 @@ See the [`DATABASES`](#databases) configuration below for usage. ## DATABASES -NetBox requires access to a PostgreSQL 14 or later database service to store data. This service can run locally on the NetBox server or on a remote system. Databases are defined as named dictionaries: +NetBox requires access to a PostgreSQL 14 or later database service to store data. Note that support for PostgreSQL 14 is deprecated and will be removed in NetBox v4.7; PostgreSQL 15 or later will be required. This service can run locally on the NetBox server or on a remote system. Databases are defined as named dictionaries: ```python DATABASES = { diff --git a/docs/installation/1-postgresql.md b/docs/installation/1-postgresql.md index 41751fc10..adb535aaf 100644 --- a/docs/installation/1-postgresql.md +++ b/docs/installation/1-postgresql.md @@ -5,6 +5,9 @@ This section entails the installation and configuration of a local PostgreSQL da !!! warning "PostgreSQL 14 or later required" NetBox requires PostgreSQL 14 or later. Please note that MySQL and other relational databases are **not** supported. +!!! warning "PostgreSQL 14 deprecation notice" + Support for PostgreSQL 14 is deprecated as of NetBox v4.6 and will be removed in NetBox v4.7. Please plan to upgrade to PostgreSQL 15 or later. + ## Installation ```no-highlight diff --git a/docs/installation/index.md b/docs/installation/index.md index 7ef8dd0d4..53e39ec5a 100644 --- a/docs/installation/index.md +++ b/docs/installation/index.md @@ -28,9 +28,11 @@ The following sections detail how to set up a new instance of NetBox: | Dependency | Supported Versions | |------------|--------------------| | Python | 3.12, 3.13, 3.14 | -| PostgreSQL | 14+ | +| PostgreSQL | 14+ [^1] | | Redis | 4.0+ | +[^1]: Support for PostgreSQL 14 is deprecated and will be removed in NetBox v4.7. PostgreSQL 15 or later will be required. + Below is a simplified overview of the NetBox application stack for reference: ![NetBox UI as seen by a non-authenticated user](../media/installation/netbox_application_stack.png) diff --git a/docs/installation/upgrading.md b/docs/installation/upgrading.md index 5110def57..938fcc68c 100644 --- a/docs/installation/upgrading.md +++ b/docs/installation/upgrading.md @@ -20,13 +20,16 @@ NetBox requires the following dependencies: | Dependency | Supported Versions | |------------|--------------------| | Python | 3.12, 3.13, 3.14 | -| PostgreSQL | 14+ | +| PostgreSQL | 14+ [^1] | | Redis | 4.0+ | +[^1]: Support for PostgreSQL 14 is deprecated and will be removed in NetBox v4.7. PostgreSQL 15 or later will be required. + ### Version History | NetBox Version | Python min | Python max | PostgreSQL min | Redis min | Documentation | |:--------------:|:----------:|:----------:|:--------------:|:---------:|:-----------------------------------------------------------------------------------------:| +| 4.6 | 3.12 | 3.14 | 14 | 4.0 | [Link](https://github.com/netbox-community/netbox/blob/v4.6.0/docs/installation/index.md) | | 4.5 | 3.12 | 3.14 | 14 | 4.0 | [Link](https://github.com/netbox-community/netbox/blob/v4.5.0/docs/installation/index.md) | | 4.4 | 3.10 | 3.12 | 14 | 4.0 | [Link](https://github.com/netbox-community/netbox/blob/v4.4.0/docs/installation/index.md) | | 4.3 | 3.10 | 3.12 | 14 | 4.0 | [Link](https://github.com/netbox-community/netbox/blob/v4.3.0/docs/installation/index.md) | diff --git a/docs/introduction.md b/docs/introduction.md index c8e5ee8ac..fee89559a 100644 --- a/docs/introduction.md +++ b/docs/introduction.md @@ -79,5 +79,7 @@ NetBox is built on the [Django](https://djangoproject.com/) Python framework and | HTTP service | nginx or Apache | | WSGI service | gunicorn or uWSGI | | Application | Django/Python | -| Database | PostgreSQL 14+ | +| Database | PostgreSQL 14+ [^1] | | Task queuing | Redis/django-rq | + +[^1]: Support for PostgreSQL 14 is deprecated and will be removed in NetBox v4.7. PostgreSQL 15 or later will be required. diff --git a/netbox/core/apps.py b/netbox/core/apps.py index 68b65f58c..86ed763b5 100644 --- a/netbox/core/apps.py +++ b/netbox/core/apps.py @@ -22,7 +22,7 @@ class CoreConfig(AppConfig): def ready(self): from core.api import schema # noqa: F401 - from core.checks import check_duplicate_indexes # noqa: F401 + from core.checks import check_duplicate_indexes, check_postgresql_version # noqa: F401 from netbox import context_managers # noqa: F401 from netbox.models.features import register_models diff --git a/netbox/core/checks.py b/netbox/core/checks.py index 430eacbec..90300bdd3 100644 --- a/netbox/core/checks.py +++ b/netbox/core/checks.py @@ -1,9 +1,11 @@ from django.apps import apps -from django.core.checks import Error, Tags, register +from django.core.checks import Error, Tags, Warning, register +from django.db import connection from django.db.models import Index, UniqueConstraint __all__ = ( 'check_duplicate_indexes', + 'check_postgresql_version', ) @@ -39,3 +41,29 @@ def check_duplicate_indexes(app_configs, **kwargs): ) return errors + + +@register(Tags.database) +def check_postgresql_version(app_configs, **kwargs): + """ + Warn if the PostgreSQL version is less than 15, as support for PostgreSQL 14 + will be removed in NetBox v4.7. + """ + warnings = [] + try: + with connection.cursor() as cursor: + cursor.execute('SHOW server_version_num') + row = cursor.fetchone() + pg_version = int(row[0]) + if pg_version < 150000: + major_version = pg_version // 10000 + warnings.append( + Warning( + f'Support for PostgreSQL {major_version} is deprecated and will be removed in NetBox v4.7.', + hint='Please upgrade to PostgreSQL 15 or later.', + id='netbox.W001', + ) + ) + except Exception: + pass + return warnings