Modify

Ticket #377 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

alter_column failing on SqLite when specifying the column name of ForeignKey

Reported by: jdstallings@… Owned by: andrew
Priority: major Milestone: 0.7
Component: commands Version: 0.7-pre
Keywords: Cc:

Description

when executing the following migration step:

db.alter_column('test_table', 'box_id', orm['test.table:box'])

I get the following exception:

  File "project/manage.py", line 11, in <module>
    execute_manager(settings)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/management/base.py", line 195, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/management/base.py", line 222, in execute
    output = self.handle(*args, **options)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/South-0.7_pre-py2.6.egg/south/management/commands/migrate.py", line 102, in handle
    delete_ghosts = delete_ghosts,
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/South-0.7_pre-py2.6.egg/south/migration/__init__.py", line 202, in migrate_app
    success = migrator.migrate_many(target, workplan, database)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/South-0.7_pre-py2.6.egg/south/migration/migrators.py", line 215, in migrate_many
    result = migrator.__class__.migrate_many(migrator, target, migrations, database)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/South-0.7_pre-py2.6.egg/south/migration/migrators.py", line 284, in migrate_many
    result = self.migrate(migration, database)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/South-0.7_pre-py2.6.egg/south/migration/migrators.py", line 121, in migrate
    result = self.run(migration)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/South-0.7_pre-py2.6.egg/south/migration/migrators.py", line 95, in run
    return self.run_migration(migration)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/South-0.7_pre-py2.6.egg/south/migration/migrators.py", line 78, in run_migration
    south.db.db.execute_deferred_sql()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/South-0.7_pre-py2.6.egg/south/db/generic.py", line 168, in execute_deferred_sql
    self.execute(sql)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/South-0.7_pre-py2.6.egg/south/db/generic.py", line 134, in execute
    cursor.execute(sql, params)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/backends/util.py", line 19, in execute
    return self.cursor.execute(sql, params)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/backends/sqlite3/base.py", line 197, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.DatabaseError: table test_table has no column named box_id_id

attached a potential fix, not sure if it breaks anything though

Attachments

ticket377.diff (502 bytes) - added by jdstallings@… 4 years ago.

Change History

Changed 4 years ago by jdstallings@…

comment:1 Changed 4 years ago by andrew

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone set to 0.7

Fixed in [eb5a5f86d57a].

View

Add a comment

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.