Failure on upgrade from 4.0.10 to 4.1.0 - relation "extras_objectchange" does not exist #10175

Closed
opened 2025-12-29 21:27:49 +01:00 by adam · 1 comment
Owner

Originally created by @duckw on GitHub (Sep 4, 2024).

Deployment Type

Self-hosted

NetBox Version

v4.1.0

Python Version

3.12

Steps to Reproduce

This is just observed after updating netbox-docker to 3.0.0, performing the build-latest and then bringing up the docker containers.

Expected Behavior

NetBox starts normally.

Observed Behavior

Logs show:

netbox-1               | ⚙️ Applying database migrations
netbox-1               | 🧬 loaded config '/etc/netbox/config/configuration.py'
netbox-1               | 🧬 loaded config '/etc/netbox/config/extra.py'
netbox-1               | 🧬 loaded config '/etc/netbox/config/logging.py'
netbox-1               | 🧬 loaded config '/etc/netbox/config/plugins.py'
netbox-1               | Operations to perform:
netbox-1               |   Apply all migrations: account, auth, circuits, contenttypes, core, dcim, django_rq, extras, ipam, sessions, social_django, taggit, tenancy, users, virtualization, vpn, wireless
netbox-1               | Running migrations:
postgres-1             | 2024-09-03 22:12:34.086 UTC [181] ERROR:  relation "extras_objectchange" does not exist at character 506
postgres-1             | 2024-09-03 22:12:34.086 UTC [181] STATEMENT:  SELECT "extras_objectchange"."id", "extras_objectchange"."time", "extras_objectchange"."user_name", "extras_objectchange"."request_id", "extras_objectchange"."action", "extras_objectchange"."changed_object_id", "extras_objectchange"."related_object_id", "extras_objectchange"."object_repr", "extras_objectchange"."prechange_data", "extras_objectchange"."postchange_data", "extras_objectchange"."changed_object_type_id", "extras_objectchange"."related_object_type_id", "extras_objectchange"."user_id" FROM "extras_objectchange" WHERE "extras_objectchange"."changed_object_type_id" IN (177) ORDER BY "extras_objectchange"."time" DESC
netbox-1               | Traceback (most recent call last):
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 105, in _execute
netbox-1               |     return self.cursor.execute(sql, params)
netbox-1               |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/psycopg/cursor.py", line 97, in execute
netbox-1               |     raise ex.with_traceback(None)
netbox-1               | psycopg.errors.UndefinedTable: relation "extras_objectchange" does not exist
netbox-1               | LINE 1: ...ct_type_id", "extras_objectchange"."user_id" FROM "extras_ob...
netbox-1               |                                                              ^
netbox-1               |
netbox-1               | The above exception was the direct cause of the following exception:
netbox-1               |
netbox-1               | Traceback (most recent call last):
netbox-1               |   File "/opt/netbox/netbox/./manage.py", line 10, in <module>
netbox-1               |     execute_from_command_line(sys.argv)
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
netbox-1               |     utility.execute()
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute
netbox-1               |     self.fetch_command(subcommand).run_from_argv(self.argv)
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 413, in run_from_argv
netbox-1               |     self.execute(*args, **cmd_options)
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 459, in execute
netbox-1               |     output = self.handle(*args, **options)
netbox-1               |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 107, in wrapper
netbox-1               |     res = handle_func(*args, **kwargs)
netbox-1               |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/commands/migrate.py", line 356, in handle
netbox-1               |     post_migrate_state = executor.migrate(
netbox-1               |                          ^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/migrations/executor.py", line 135, in migrate
netbox-1               |     state = self._migrate_all_forwards(
netbox-1               |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
netbox-1               |     state = self.apply_migration(
netbox-1               |             ^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/migrations/executor.py", line 252, in apply_migration
netbox-1               |     state = migration.apply(state, schema_editor)
netbox-1               |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/migrations/migration.py", line 132, in apply
netbox-1               |     operation.database_forwards(
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/migrations/operations/special.py", line 193, in database_forwards
netbox-1               |     self.code(from_state.apps, schema_editor)
netbox-1               |   File "/opt/netbox/netbox/extras/migrations/0117_move_objectchange.py", line 8, in update_content_types
netbox-1               |     ContentType.objects.filter(app_label='core', model='objectchange').delete()
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/models/query.py", line 1187, in delete
netbox-1               |     collector.collect(del_query)
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/models/deletion.py", line 348, in collect
netbox-1               |     if getattr(on_delete, "lazy_sub_objs", False) or sub_objs:
netbox-1               |                                                      ^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/models/query.py", line 414, in __bool__
netbox-1               |     self._fetch_all()
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/models/query.py", line 1928, in _fetch_all
netbox-1               |     self._result_cache = list(self._iterable_class(self))
netbox-1               |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/models/query.py", line 91, in __iter__
netbox-1               |     results = compiler.execute_sql(
netbox-1               |               ^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql
netbox-1               |     cursor.execute(sql, params)
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 79, in execute
netbox-1               |     return self._execute_with_wrappers(
netbox-1               |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
netbox-1               |     return executor(sql, params, many, context)
netbox-1               |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 100, in _execute
netbox-1               |     with self.db.wrap_database_errors:
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/utils.py", line 91, in __exit__
netbox-1               |     raise dj_exc_value.with_traceback(traceback) from exc_value
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 105, in _execute
netbox-1               |     return self.cursor.execute(sql, params)
netbox-1               |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/psycopg/cursor.py", line 97, in execute
netbox-1               |     raise ex.with_traceback(None)
netbox-1               | django.db.utils.ProgrammingError: relation "extras_objectchange" does not exist
netbox-1               | LINE 1: ...ct_type_id", "extras_objectchange"."user_id" FROM "extras_ob...
netbox-1               |                                                              ^
netbox-1               |   Applying extras.0117_move_objectchange...
netbox-1 exited with code 1
Originally created by @duckw on GitHub (Sep 4, 2024). ### Deployment Type Self-hosted ### NetBox Version v4.1.0 ### Python Version 3.12 ### Steps to Reproduce This is just observed after updating netbox-docker to 3.0.0, performing the build-latest and then bringing up the docker containers. ### Expected Behavior NetBox starts normally. ### Observed Behavior Logs show: ``` netbox-1 | ⚙️ Applying database migrations netbox-1 | 🧬 loaded config '/etc/netbox/config/configuration.py' netbox-1 | 🧬 loaded config '/etc/netbox/config/extra.py' netbox-1 | 🧬 loaded config '/etc/netbox/config/logging.py' netbox-1 | 🧬 loaded config '/etc/netbox/config/plugins.py' netbox-1 | Operations to perform: netbox-1 | Apply all migrations: account, auth, circuits, contenttypes, core, dcim, django_rq, extras, ipam, sessions, social_django, taggit, tenancy, users, virtualization, vpn, wireless netbox-1 | Running migrations: postgres-1 | 2024-09-03 22:12:34.086 UTC [181] ERROR: relation "extras_objectchange" does not exist at character 506 postgres-1 | 2024-09-03 22:12:34.086 UTC [181] STATEMENT: SELECT "extras_objectchange"."id", "extras_objectchange"."time", "extras_objectchange"."user_name", "extras_objectchange"."request_id", "extras_objectchange"."action", "extras_objectchange"."changed_object_id", "extras_objectchange"."related_object_id", "extras_objectchange"."object_repr", "extras_objectchange"."prechange_data", "extras_objectchange"."postchange_data", "extras_objectchange"."changed_object_type_id", "extras_objectchange"."related_object_type_id", "extras_objectchange"."user_id" FROM "extras_objectchange" WHERE "extras_objectchange"."changed_object_type_id" IN (177) ORDER BY "extras_objectchange"."time" DESC netbox-1 | Traceback (most recent call last): netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 105, in _execute netbox-1 | return self.cursor.execute(sql, params) netbox-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/psycopg/cursor.py", line 97, in execute netbox-1 | raise ex.with_traceback(None) netbox-1 | psycopg.errors.UndefinedTable: relation "extras_objectchange" does not exist netbox-1 | LINE 1: ...ct_type_id", "extras_objectchange"."user_id" FROM "extras_ob... netbox-1 | ^ netbox-1 | netbox-1 | The above exception was the direct cause of the following exception: netbox-1 | netbox-1 | Traceback (most recent call last): netbox-1 | File "/opt/netbox/netbox/./manage.py", line 10, in <module> netbox-1 | execute_from_command_line(sys.argv) netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line netbox-1 | utility.execute() netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute netbox-1 | self.fetch_command(subcommand).run_from_argv(self.argv) netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 413, in run_from_argv netbox-1 | self.execute(*args, **cmd_options) netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 459, in execute netbox-1 | output = self.handle(*args, **options) netbox-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 107, in wrapper netbox-1 | res = handle_func(*args, **kwargs) netbox-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/commands/migrate.py", line 356, in handle netbox-1 | post_migrate_state = executor.migrate( netbox-1 | ^^^^^^^^^^^^^^^^^ netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/migrations/executor.py", line 135, in migrate netbox-1 | state = self._migrate_all_forwards( netbox-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards netbox-1 | state = self.apply_migration( netbox-1 | ^^^^^^^^^^^^^^^^^^^^^ netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/migrations/executor.py", line 252, in apply_migration netbox-1 | state = migration.apply(state, schema_editor) netbox-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/migrations/migration.py", line 132, in apply netbox-1 | operation.database_forwards( netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/migrations/operations/special.py", line 193, in database_forwards netbox-1 | self.code(from_state.apps, schema_editor) netbox-1 | File "/opt/netbox/netbox/extras/migrations/0117_move_objectchange.py", line 8, in update_content_types netbox-1 | ContentType.objects.filter(app_label='core', model='objectchange').delete() netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/models/query.py", line 1187, in delete netbox-1 | collector.collect(del_query) netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/models/deletion.py", line 348, in collect netbox-1 | if getattr(on_delete, "lazy_sub_objs", False) or sub_objs: netbox-1 | ^^^^^^^^ netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/models/query.py", line 414, in __bool__ netbox-1 | self._fetch_all() netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/models/query.py", line 1928, in _fetch_all netbox-1 | self._result_cache = list(self._iterable_class(self)) netbox-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/models/query.py", line 91, in __iter__ netbox-1 | results = compiler.execute_sql( netbox-1 | ^^^^^^^^^^^^^^^^^^^^^ netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql netbox-1 | cursor.execute(sql, params) netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 79, in execute netbox-1 | return self._execute_with_wrappers( netbox-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers netbox-1 | return executor(sql, params, many, context) netbox-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 100, in _execute netbox-1 | with self.db.wrap_database_errors: netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/utils.py", line 91, in __exit__ netbox-1 | raise dj_exc_value.with_traceback(traceback) from exc_value netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 105, in _execute netbox-1 | return self.cursor.execute(sql, params) netbox-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ netbox-1 | File "/opt/netbox/venv/lib/python3.12/site-packages/psycopg/cursor.py", line 97, in execute netbox-1 | raise ex.with_traceback(None) netbox-1 | django.db.utils.ProgrammingError: relation "extras_objectchange" does not exist netbox-1 | LINE 1: ...ct_type_id", "extras_objectchange"."user_id" FROM "extras_ob... netbox-1 | ^ netbox-1 | Applying extras.0117_move_objectchange... netbox-1 exited with code 1 ```
adam closed this issue 2025-12-29 21:27:49 +01:00
Author
Owner

@jeremystretch commented on GitHub (Sep 4, 2024):

Please raise this issue to the netbox-docker repository.

@jeremystretch commented on GitHub (Sep 4, 2024): Please raise this issue to the [netbox-docker](https://github.com/netbox-community/netbox-docker) repository.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10175