Migration failing on column extras_topologymap.type #1559

Closed
opened 2025-12-29 16:32:57 +01:00 by adam · 4 comments
Owner

Originally created by @lae on GitHub (Feb 17, 2018).

Issue type

[ ] Feature request
[x] Bug report
[ ] Documentation

Environment

  • Python version: 2.7, 3.4, 3.5, 3.6
  • NetBox version: develop @ 2d93c2b2da

Description

Performing the usual steps for deploying Netbox, the deploy appears to fail when running migrations

stdout: Operations to perform:
  Apply all migrations: admin, auth, circuits, contenttypes, dcim, extras, ipam, secrets, sessions, tenancy, users, virtualization
Running migrations:
  Applying extras.0004_topologymap_change_comma_to_semicolon...
:stderr: /srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
  """)
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 204, in handle
    fake_initial=fake_initial,
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 115, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/migrations/migration.py", line 129, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/migrations/operations/special.py", line 193, in database_forwards
    self.code(from_state.apps, schema_editor)
  File "/srv/netbox/releases/git-deploy/netbox/extras/migrations/0004_topologymap_change_comma_to_semicolon.py", line 11, in commas_to_semicolons
    for tm in TopologyMap.objects.filter(device_patterns__contains=','):
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/models/query.py", line 250, in __iter__
    self._fetch_all()
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/models/query.py", line 1118, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/models/query.py", line 53, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 899, in execute_sql
    raise original_exception
django.db.utils.ProgrammingError: column extras_topologymap.type does not exist
LINE 1: ...topologymap"."name", "extras_topologymap"."slug", "extras_to...
                                                             ^

(above error and context can be seen here: https://travis-ci.org/lae/ansible-role-netbox/jobs/342560899#L6417)

Originally created by @lae on GitHub (Feb 17, 2018). ### Issue type [ ] Feature request [x] Bug report [ ] Documentation ### Environment * Python version: 2.7, 3.4, 3.5, 3.6 * NetBox version: develop @ https://github.com/digitalocean/netbox/commit/2d93c2b2daeb5e668f8e7fd0d18931d9c884f41e ### Description Performing the usual steps for deploying Netbox, the deploy appears to fail when running migrations ``` stdout: Operations to perform: Apply all migrations: admin, auth, circuits, contenttypes, dcim, extras, ipam, secrets, sessions, tenancy, users, virtualization Running migrations: Applying extras.0004_topologymap_change_comma_to_semicolon... :stderr: /srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>. """) Traceback (most recent call last): File "./manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line utility.execute() File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv self.execute(*args, **cmd_options) File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute output = self.handle(*args, **options) File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 204, in handle fake_initial=fake_initial, File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 115, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial) File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 244, in apply_migration state = migration.apply(state, schema_editor) File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/migrations/migration.py", line 129, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/migrations/operations/special.py", line 193, in database_forwards self.code(from_state.apps, schema_editor) File "/srv/netbox/releases/git-deploy/netbox/extras/migrations/0004_topologymap_change_comma_to_semicolon.py", line 11, in commas_to_semicolons for tm in TopologyMap.objects.filter(device_patterns__contains=','): File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/models/query.py", line 250, in __iter__ self._fetch_all() File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/models/query.py", line 1118, in _fetch_all self._result_cache = list(self._iterable_class(self)) File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/models/query.py", line 53, in __iter__ results = compiler.execute_sql(chunked_fetch=self.chunked_fetch) File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 899, in execute_sql raise original_exception django.db.utils.ProgrammingError: column extras_topologymap.type does not exist LINE 1: ...topologymap"."name", "extras_topologymap"."slug", "extras_to... ^ ``` (above error and context can be seen here: https://travis-ci.org/lae/ansible-role-netbox/jobs/342560899#L6417)
adam added the type: bugstatus: accepted labels 2025-12-29 16:32:57 +01:00
adam closed this issue 2025-12-29 16:32:57 +01:00
Author
Owner

@terrytrent commented on GitHub (Feb 17, 2018):

I'm having this issue as well, hopefully we can see this fixed quickly

@terrytrent commented on GitHub (Feb 17, 2018): I'm having this issue as well, hopefully we can see this fixed quickly
Author
Owner

@lampwins commented on GitHub (Feb 17, 2018):

Performing the usual steps for deploying Netbox

Keep in mind you are using the develop branch which makes no guarantees at being stable at given point in time. The master branch is the only branch considered stable for production deployment.

@lampwins commented on GitHub (Feb 17, 2018): > Performing the usual steps for deploying Netbox Keep in mind you are using the `develop` branch which makes no guarantees at being stable at given point in time. The `master` branch is the only branch considered stable for production deployment.
Author
Owner

@lae commented on GitHub (Feb 17, 2018):

@lampwins I'm sorry if I wasn't clear, this is from my automated tests for NetBox before stable releases. I'm not using the develop branch in production.

See: https://travis-ci.org/lae/ansible-role-netbox/builds/342560897

Basically, I got notified that deployment tests were failing and so I'm reporting it upstream.

@lae commented on GitHub (Feb 17, 2018): @lampwins I'm sorry if I wasn't clear, this is from my automated tests for NetBox *before* stable releases. I'm not using the develop branch in production. See: https://travis-ci.org/lae/ansible-role-netbox/builds/342560897 Basically, I got notified that deployment tests were failing and so I'm reporting it upstream.
Author
Owner

@jeremystretch commented on GitHub (Feb 21, 2018):

Kudos to @lampwins for tracking this down to #632 back in v1.7.0. The issue appears to be this function in a prior migration which imports the TopologyMap model to automatically convert commas in regular expressions to semicolons.

Given that this is merely a convenience function which would only benefit someone upgrading from a release older than v1.7.0 (released 2016-11-03), the simplest solution is probably to just alter that migration and remove the function.

@jeremystretch commented on GitHub (Feb 21, 2018): Kudos to @lampwins for tracking this down to #632 back in v1.7.0. The issue appears to be [this function](https://github.com/digitalocean/netbox/blob/develop/netbox/extras/migrations/0004_topologymap_change_comma_to_semicolon.py#L10-L13) in a prior migration which imports the TopologyMap model to automatically convert commas in regular expressions to semicolons. Given that this is merely a convenience function which would only benefit someone upgrading from a release older than v1.7.0 (released 2016-11-03), the simplest solution is probably to just alter that migration and remove the function.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1559