id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc
377,alter_column failing on SqLite when specifying the column name of ForeignKey,jdstallings@…,andrew,"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
",defect,closed,major,0.7,commands,0.7-pre,fixed,,
