relation "dcim_rackrole" does not exist when adding rack #414

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

Originally created by @fourg on GitHub (Sep 3, 2016).

Running latest 1.5.2. Seeing the error below when attempting to access the /dcim/racks/add/ page. When I tried to flush the django database it also refused to let me stating the same does not exist error.

<class 'django.db.utils.ProgrammingError'>

relation "dcim_rackrole" does not exist
LINE 1: ...im_rackrole"."slug", "dcim_rackrole"."color" FROM "dcim_rack...
^

Originally created by @fourg on GitHub (Sep 3, 2016). Running latest 1.5.2. Seeing the error below when attempting to access the /dcim/racks/add/ page. When I tried to flush the django database it also refused to let me stating the same does not exist error. <class 'django.db.utils.ProgrammingError'> relation "dcim_rackrole" does not exist LINE 1: ...im_rackrole"."slug", "dcim_rackrole"."color" FROM "dcim_rack... ^
adam closed this issue 2025-12-29 16:21:48 +01:00
Author
Owner

@AlexanderS commented on GitHub (Sep 3, 2016):

Did you apply the database migrations after the update (either by calling the update.sh script or by calling ./netbox/manage.py migrate manually)?

@AlexanderS commented on GitHub (Sep 3, 2016): Did you apply the database migrations after the update (either by calling the `update.sh` script or by calling `./netbox/manage.py migrate` manually)?
Author
Owner

@fourg commented on GitHub (Sep 3, 2016):

Yes I ran the update.sh and just tried manage.py migrate as well. I only have a single rack created so far and it's assigned to one of two sites. When I browse to /dcim/sites/<name2> I can see in the Stats window that 1 rack is associated with it, however if I click on that which takes me to /dcim/racks/?site=<name2> I get similar, but different error as I mentioned in the original post. Lastly, if I browse to /dcim/racks/ I see no racks listed, whether I'm logged in with the admin account or not. I would expect to see the one rack I have on this page of course.

<class 'django.db.utils.ProgrammingError'>

column dcim_rack.role_id does not exist
LINE 1: ...oup_id" AS Col7, "dcim_rack"."tenant_id" AS Col8, "dcim_rack...
                                                             ^
HINT:  Perhaps you meant to reference the column "dcim_rack.group_id" or the column "dcim_rack.site_id".

Thanks

@fourg commented on GitHub (Sep 3, 2016): Yes I ran the update.sh and just tried manage.py migrate as well. I only have a single rack created so far and it's assigned to one of two sites. When I browse to `/dcim/sites/<name2>` I can see in the Stats window that 1 rack is associated with it, however if I click on that which takes me to `/dcim/racks/?site=<name2>` I get similar, but different error as I mentioned in the original post. Lastly, if I browse to `/dcim/racks/` I see no racks listed, whether I'm logged in with the admin account or not. I would expect to see the one rack I have on this page of course. ``` <class 'django.db.utils.ProgrammingError'> column dcim_rack.role_id does not exist LINE 1: ...oup_id" AS Col7, "dcim_rack"."tenant_id" AS Col8, "dcim_rack... ^ HINT: Perhaps you meant to reference the column "dcim_rack.group_id" or the column "dcim_rack.site_id". ``` Thanks
Author
Owner

@fourg commented on GitHub (Sep 9, 2016):

Below is my output when running ./manage.py migrate

Operations to perform:
Apply all migrations: admin, auth, circuits, contenttypes, dcim, extras, ipam, secrets, sessions, tenancy
Running migrations:
Rendering model states... DONE
Applying circuits.0005_circuit_add_upstream_speed...Traceback (most recent call last):
File "./manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 367, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 305, in run_from_argv
self.execute(_args, *_cmd_options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 356, in execute
output = self.handle(_args, *_options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/migrate.py", line 202, in handle
targets, plan, fake=fake, fake_initial=fake_initial
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 97, in migrate
state = self._migrate_all_forwards(plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 132, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 237, in apply_migration
state = migration.apply(state, schema_editor)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/migration.py", line 129, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/operations/fields.py", line 84, in database_forwards
field,
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql/schema.py", line 21, in add_field
super(DatabaseSchemaEditor, self).add_field(model, field)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/schema.py", line 409, in add_field
self.execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/schema.py", line 112, in execute
cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 94, in exit
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: column "upstream_speed" of relation "circuits_circuit" already exists

@fourg commented on GitHub (Sep 9, 2016): Below is my output when running ./manage.py migrate Operations to perform: Apply all migrations: admin, auth, circuits, contenttypes, dcim, extras, ipam, secrets, sessions, tenancy Running migrations: Rendering model states... DONE Applying circuits.0005_circuit_add_upstream_speed...Traceback (most recent call last): File "./manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/**init**.py", line 367, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/dist-packages/django/core/management/**init**.py", line 359, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 305, in run_from_argv self.execute(_args, *_cmd_options) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 356, in execute output = self.handle(_args, *_options) File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/migrate.py", line 202, in handle targets, plan, fake=fake, fake_initial=fake_initial File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 97, in migrate state = self._migrate_all_forwards(plan, full_plan, fake=fake, fake_initial=fake_initial) File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 132, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 237, in apply_migration state = migration.apply(state, schema_editor) File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/migration.py", line 129, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/operations/fields.py", line 84, in database_forwards field, File "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql/schema.py", line 21, in add_field super(DatabaseSchemaEditor, self).add_field(model, field) File "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/schema.py", line 409, in add_field self.execute(sql, params) File "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/schema.py", line 112, in execute cursor.execute(sql, params) File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 94, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) **django.db.utils.ProgrammingError: column "upstream_speed" of relation "circuits_circuit" already exists**
Author
Owner

@jeremystretch commented on GitHub (Sep 12, 2016):

Looks like something went wrong during an installation or upgrade. Sorry, but I can't offer any more help than that without knowing exactly what operations were performed. I'd restore the most recent known-good backup and re-run upgrade.sh, or just start over fresh.

@jeremystretch commented on GitHub (Sep 12, 2016): Looks like something went wrong during an installation or upgrade. Sorry, but I can't offer any more help than that without knowing exactly what operations were performed. I'd restore the most recent known-good backup and re-run `upgrade.sh`, or just start over fresh.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#414