Database Migration from 3.2.9 > 3.3.0 fails #930
Unanswered
wmarucha
asked this question in
Getting Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So I have been working on trying to get our organization to the latest version of netbox and the upgrade to version 3.3.0 is where it is falling apart. I have spun up a new container for version 3.3.0 and got it running perfectly fine. When I then try to apply the db_dump file from our current install to the new container it is failing on the database migration with the following errors. Any advice or tips is welcomed as I have been bashing my head on my keyboard for the last few hours trying to get this working.
netbox_1 | Running migrations:
postgres_1 | 2023-01-27 22:25:47.333 UTC [47] ERROR: column "status" of relation "dcim_location" already exists
postgres_1 | 2023-01-27 22:25:47.333 UTC [47] STATEMENT: ALTER TABLE "dcim_location" ADD COLUMN "status" varchar(50) DEFAULT 'active' NOT NULL
netbox_1 | Applying dcim.0156_location_status...Traceback (most recent call last):
netbox_1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
netbox_1 | return self.cursor.execute(sql, params)
netbox_1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django_prometheus/db/common.py", line 71, in execute
netbox_1 | return super().execute(*args, **kwargs)
netbox_1 | psycopg2.errors.DuplicateColumn: column "status" of relation "dcim_location" already exists
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
netbox_1 | execute_from_command_line(sys.argv)
netbox_1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/init.py", line 446, in execute_from_command_line
netbox_1 | utility.execute()
netbox_1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/init.py", line 440, in execute
netbox_1 | self.fetch_command(subcommand).run_from_argv(self.argv)
netbox_1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/base.py", line 414, in run_from_argv
netbox_1 | self.execute(*args, **cmd_options)
netbox_1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/base.py", line 460, in execute
netbox_1 | output = self.handle(*args, **options)
netbox_1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/base.py", line 98, in wrapped
netbox_1 | res = handle_func(*args, **kwargs)
netbox_1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 290, in handle
netbox_1 | post_migrate_state = executor.migrate(
netbox_1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/migrations/executor.py", line 131, in migrate
netbox_1 | state = self._migrate_all_forwards(
netbox_1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/migrations/executor.py", line 163, in _migrate_all_forwards
netbox_1 | state = self.apply_migration(
netbox_1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/migrations/executor.py", line 248, in apply_migration
netbox_1 | state = migration.apply(state, schema_editor)
netbox_1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/migrations/migration.py", line 131, in apply
netbox_1 | operation.database_forwards(
netbox_1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/migrations/operations/fields.py", line 108, in database_forwards
netbox_1 | schema_editor.add_field(
netbox_1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/base/schema.py", line 641, in add_field
netbox_1 | self.execute(sql, params)
netbox_1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/base/schema.py", line 192, in execute
netbox_1 | cursor.execute(sql, params)
netbox_1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 67, in execute
netbox_1 | return self._execute_with_wrappers(
netbox_1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
netbox_1 | return executor(sql, params, many, context)
netbox_1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute
netbox_1 | with self.db.wrap_database_errors:
netbox_1 | File "/opt/netbox/venv/lib/python3.10/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.10/site-packages/django/db/backends/utils.py", line 89, in _execute
netbox_1 | return self.cursor.execute(sql, params)
netbox_1 | File "/opt/netbox/venv/lib/python3.10/site-packages/django_prometheus/db/common.py", line 71, in execute
netbox_1 | return super().execute(*args, **kwargs)
netbox_1 | django.db.utils.ProgrammingError: column "status" of relation "dcim_location" already exists
Beta Was this translation helpful? Give feedback.
All reactions