manage.py migrate fails #1289

Closed
opened 2025-12-29 16:31:07 +01:00 by adam · 1 comment
Owner

Originally created by @jcv- on GitHub (Oct 10, 2017).

Issue type

[ ] Feature request
[X] Bug report
[ ] Documentation

Environment

  • Python version: 3.4.5
  • NetBox version: 2.1.5 / 2.2-beta2

Description

I am stepping through the readme and I receive the following when running python manage.py migrate
Running migrations:
Applying dcim.0008_device_remove_primary_ip...Traceback (most recent call last):
File "/usr/lib/python3.4/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: syntax error at or near "ORDER"
LINE 3: indexname, array_agg(attname ORDER BY rnum),...
^

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/lib/python3.4/site-packages/django/core/management/init.py", line 364, in execute_from_command_line
utility.execute()
File "/usr/lib/python3.4/site-packages/django/core/management/init.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python3.4/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/lib/python3.4/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/usr/lib/python3.4/site-packages/django/core/management/commands/migrate.py", line 204, in handle
fake_initial=fake_initial,
File "/usr/lib/python3.4/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 "/usr/lib/python3.4/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 "/usr/lib/python3.4/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
state = migration.apply(state, schema_editor)
File "/usr/lib/python3.4/site-packages/django/db/migrations/migration.py", line 129, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/usr/lib/python3.4/site-packages/django/db/migrations/operations/fields.py", line 155, in database_forwards
schema_editor.remove_field(from_model, from_model._meta.get_field(self.name))
File "/usr/lib/python3.4/site-packages/django/db/backends/base/schema.py", line 463, in remove_field
fk_names = self._constraint_names(model, [field.column], foreign_key=True)
File "/usr/lib/python3.4/site-packages/django/db/backends/base/schema.py", line 989, in _constraint_names
constraints = self.connection.introspection.get_constraints(cursor, model._meta.db_table)
File "/usr/lib/python3.4/site-packages/django/db/backends/postgresql/introspection.py", line 233, in get_constraints
""", [table_name])
File "/usr/lib/python3.4/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/usr/lib/python3.4/site-packages/django/db/utils.py", line 94, in exit
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/usr/lib/python3.4/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/usr/lib/python3.4/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: syntax error at or near "ORDER"
LINE 3: indexname, array_agg(attname ORDER BY rnum),...

Originally created by @jcv- on GitHub (Oct 10, 2017). <!-- Before opening a new issue, please search through the existing issues to see if your topic has already been addressed. Note that you may need to remove the "is:open" filter from the search bar to include closed issues. Check the appropriate type for your issue below by placing an x between the brackets. If none of the below apply, please raise your issue for discussion on our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please note that issues which do not fall under any of the below categories will be closed. ---> ### Issue type [ ] Feature request <!-- Requesting the implementation of a new feature --> [X] Bug report <!-- Reporting unexpected or erroneous behavior --> [ ] Documentation <!-- Proposing a modification to the documentation --> <!-- Please describe the environment in which you are running NetBox. (Be sure to verify that you are running the latest stable release of NetBox before submitting a bug report.) --> ### Environment * Python version: 3.4.5 * NetBox version: 2.1.5 / 2.2-beta2 <!-- BUG REPORTS must include: * A list of the steps needed to reproduce the bug * A description of the expected behavior * Any relevant error messages (screenshots may also help) FEATURE REQUESTS must include: * A detailed description of the proposed functionality * A use case for the new feature * A rough description of any necessary changes to the database schema * Any relevant third-party libraries which would be needed --> ### Description I am stepping through the readme and I receive the following when running python manage.py migrate Running migrations: Applying dcim.0008_device_remove_primary_ip...Traceback (most recent call last): File "/usr/lib/python3.4/site-packages/django/db/backends/utils.py", line 65, in execute return self.cursor.execute(sql, params) psycopg2.ProgrammingError: syntax error at or near "ORDER" LINE 3: indexname, array_agg(attname ORDER BY rnum),... ^ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/lib/python3.4/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line utility.execute() File "/usr/lib/python3.4/site-packages/django/core/management/__init__.py", line 356, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/lib/python3.4/site-packages/django/core/management/base.py", line 283, in run_from_argv self.execute(*args, **cmd_options) File "/usr/lib/python3.4/site-packages/django/core/management/base.py", line 330, in execute output = self.handle(*args, **options) File "/usr/lib/python3.4/site-packages/django/core/management/commands/migrate.py", line 204, in handle fake_initial=fake_initial, File "/usr/lib/python3.4/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 "/usr/lib/python3.4/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 "/usr/lib/python3.4/site-packages/django/db/migrations/executor.py", line 244, in apply_migration state = migration.apply(state, schema_editor) File "/usr/lib/python3.4/site-packages/django/db/migrations/migration.py", line 129, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "/usr/lib/python3.4/site-packages/django/db/migrations/operations/fields.py", line 155, in database_forwards schema_editor.remove_field(from_model, from_model._meta.get_field(self.name)) File "/usr/lib/python3.4/site-packages/django/db/backends/base/schema.py", line 463, in remove_field fk_names = self._constraint_names(model, [field.column], foreign_key=True) File "/usr/lib/python3.4/site-packages/django/db/backends/base/schema.py", line 989, in _constraint_names constraints = self.connection.introspection.get_constraints(cursor, model._meta.db_table) File "/usr/lib/python3.4/site-packages/django/db/backends/postgresql/introspection.py", line 233, in get_constraints """, [table_name]) File "/usr/lib/python3.4/site-packages/django/db/backends/utils.py", line 65, in execute return self.cursor.execute(sql, params) File "/usr/lib/python3.4/site-packages/django/db/utils.py", line 94, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "/usr/lib/python3.4/site-packages/django/utils/six.py", line 685, in reraise raise value.with_traceback(tb) File "/usr/lib/python3.4/site-packages/django/db/backends/utils.py", line 65, in execute return self.cursor.execute(sql, params) django.db.utils.ProgrammingError: syntax error at or near "ORDER" LINE 3: indexname, array_agg(attname ORDER BY rnum),...
adam closed this issue 2025-12-29 16:31:07 +01:00
Author
Owner

@jeremystretch commented on GitHub (Oct 10, 2017):

Thank you for your interest in NetBox. GitHub issues are intended for reporting bugs and requesting features, and must be submitted using the template provided here. For general discussion, questions, or assistance with installation issues, please post to our mailing list.

@jeremystretch commented on GitHub (Oct 10, 2017): Thank you for your interest in NetBox. GitHub issues are intended for reporting bugs and requesting features, and must be submitted using the template provided [here](https://raw.githubusercontent.com/digitalocean/netbox/develop/.github/ISSUE_TEMPLATE.md). For general discussion, questions, or assistance with installation issues, please post to our [mailing list](https://groups.google.com/forum/#!forum/netbox-discuss).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1289