Replies: 1 comment 5 replies
-
So you upgraded to 3.3.1, then restored the old database and then tried to run the new code with the old database? Is this correctly understood? If so, that is not supported. Downgrade your netbox install as well if you want to downgrade. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
NetBox version
v3.3.1
Python version
3.8
Steps to Reproduce
Expected Behavior
Netbox is up and no errros on the interface after restore
Observed Behavior
Running migrations:
Applying dcim.0158_populate_cable_terminations...
Updated 8100/8109 cables (99.89%)Traceback (most recent call last):
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "dcim_cable_termination_unique_termination"
DETAIL: Key (termination_type_id, termination_id)=(43, 1875) already exists.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "netbox/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/core/management/init.py", line 446, in execute_from_command_line
utility.execute()
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/core/management/init.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/core/management/base.py", line 414, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/core/management/base.py", line 460, in execute
output = self.handle(*args, **options)
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/core/management/base.py", line 98, in wrapped
res = handle_func(*args, **kwargs)
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 290, in handle
post_migrate_state = executor.migrate(
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 131, in migrate
state = self._migrate_all_forwards(
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 163, in _migrate_all_forwards
state = self.apply_migration(
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 248, in apply_migration
state = migration.apply(state, schema_editor)
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/db/migrations/migration.py", line 131, in apply
operation.database_forwards(
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/db/migrations/operations/special.py", line 193, in database_forwards
self.code(from_state.apps, schema_editor)
File "/opt/netbox-3.3.1/netbox/dcim/migrations/0158_populate_cable_terminations.py", line 73, in populate_cable_terminations
CableTermination.objects.bulk_create(cable_terminations, batch_size=100)
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/db/models/query.py", line 579, in bulk_create
returned_columns = self._batched_insert(
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/db/models/query.py", line 1458, in _batched_insert
self._insert(
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/db/models/query.py", line 1434, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1621, in execute_sql
cursor.execute(sql, params)
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/db/utils.py", line 91, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/netbox-3.3.1/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
django.db.utils.IntegrityError: duplicate key value violates unique constraint "dcim_cable_termination_unique_termination"
DETAIL: Key (termination_type_id, termination_id)=(43, 1875) already exists.
Beta Was this translation helpful? Give feedback.
All reactions