开发者

Django South migration fails

开发者 https://www.devze.com 2023-04-12 12:08 出处:网络
I am trying to map some data onto a staging server and have run into an issue. When running my migrations I get the following error.

I am trying to map some data onto a staging server and have run into an issue.

When running my migrations I get the following error.

django.db.utils.DatabaseError: column "item_name_id" cannot be cast to type "pg_catalog.int4"

Any ideas how I can resolve this?

Traceback (most recent call last):
  File "gecko/manage.py", line 11, in <module>
    execute_manager(settings)
  File "/app/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/app/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/app/lib/python2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/app/lib/python2.7/site-packages/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/app/lib/python2.7/site-packages/south/management/commands/migrate.py", line 105, in handle
    ignore_ghosts = ignore_ghosts,
  File "/app/lib/python2.7/site-packages/south/migration/__init__.py", line 191, in migrate_app
    success = migrator.migrate_many(target, workplan, database)
  File "/app/lib/python2.7/site-packages/south开发者_StackOverflow/migration/migrators.py", line 221, in migrate_many
    result = migrator.__class__.migrate_many(migrator, target, migrations, database)
  File "/app/lib/python2.7/site-packages/south/migration/migrators.py", line 292, in migrate_many
    result = self.migrate(migration, database)
  File "/app/lib/python2.7/site-packages/south/migration/migrators.py", line 125, in migrate
    result = self.run(migration)
  File "/app/lib/python2.7/site-packages/south/migration/migrators.py", line 99, in run
    return self.run_migration(migration)
  File "/app/lib/python2.7/site-packages/south/migration/migrators.py", line 81, in run_migration
    migration_function()
  File "/app/lib/python2.7/site-packages/south/migration/migrators.py", line 57, in <lambda>
    return (lambda: direction(orm))
  File "/app/gecko/quote/migrations/0015_auto__chg_field_order_item_name.py", line 14, in forwards
    db.alter_column('quote_order', 'item_name_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['fleet.Group']))
  File "/app/lib/python2.7/site-packages/south/db/generic.py", line 382, in alter_column
    flatten(values),
  File "/app/lib/python2.7/site-packages/south/db/generic.py", line 150, in execute
    cursor.execute(sql, params)
  File "/app/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute
    return self.cursor.execute(query, args)
django.db.utils.DatabaseError: column "item_name_id" cannot be cast to type "pg_catalog.int4"


Your question is tagged mysql yet the Traceback shows you're using the postgresql_psycopg2 backend. Could that be the problem?

Fix the tags on the question or set the right DATABASE_ENGINE in your settings.py.

0

精彩评论

暂无评论...
验证码 换一张
取 消