It could be a bug or your database might be in an inconsistent state
somehow. The next step would be to debug it a bit more and put together a
minimal project that reproduces the issue.
On Monday, December 12, 2016 at 4:45:55 PM UTC-5, Francis Fisher wrote:
>
> Any idea if I'm doing something wrong or if I'm running into a bug?
>
> I added some fields to a model, and generated a migration.
>
> When I apply the migration, the migrate command crashes, with both django
> 1.10.3 and 1.10.4.
> I had a similar migration issue with another app in the same project, that
> occured in django 1.10 and 1.10.3.
>
> Is this crash a known issue/common pitfall?
>
> Cheers,
> Frankie
>
>
>
> ---------------------------------------------
> Result of the "makemigrations":
>
> Migrations for 'eveshoppinglist':
> evetools/eveshoppinglist/migrations/0009_auto_20161212_2140.py:
> - Rename field build_location_type on buildline to build_facility_type
> - Rename field from_location_id on moveline to from_facility_id
> - Rename field from_type on moveline to from_facility_type
> - Rename field to_location_id on moveline to to_facility_id
> - Rename field to_type on moveline to to_facility_type
> - Add field build_facility_id to buildline
> - Add field build_system to buildline
> - Add field build_facility_id to buyline
> - Add field build_facility_type to buyline
> - Add field build_system to buyline
> - Add field from_system to moveline
> - Add field to_system to moveline
>
>
> -----------------------------------------------------------------
> Result of "migrate"
>
> File "evetools/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 294, in run_from_argv
> self.execute(*args, **cmd_options)
> File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
> line 345, in execute
> output = self.handle(*args, **options)
> File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/migrate.py",
>
> line 204, in handle
> fake_initial=fake_initial,
> File
> "/usr/local/lib/python2.7/dist-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/local/lib/python2.7/dist-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/local/lib/python2.7/dist-packages/django/db/migrations/executor.py",
> line 244, 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 282, in database_forwards
> to_model._meta.get_field(self.new_name),
> File
> "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/schema.py",
> line 495, in alter_field
> old_db_params, new_db_params, strict)
> File
> "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql/schema.py",
>
> line 117, in _alter_field
> new_db_params, strict,
> File
> "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/schema.py",
> line 504, in _alter_field
> fk_names = self._constraint_names(model, [old_field.column],
> foreign_key=True)
> File
> "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/schema.py",
> line 931, in _constraint_names
> constraints = self.connection.introspection.get_constraints(cursor,
> model._meta.db_table)
> File
> "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql/introspection.py",
>
> line 178, in get_constraints
> "foreign_key": tuple(used_cols[0].split(".", 1)) if kind.lower() ==
> "foreign key" else None,
>
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/2893b3d1-80a3-4452-9de6-61826e1e5318%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.