postgresql - Django + South - migration can't cast the column type - wants me to use "USING" -


i'm getting error when try run ./manage.py migrate my_app:

django.db.utils.programmingerror: column "associated" cannot cast automatically type integer
hint: specify using expression perform conversion.

that sounds great advice, don't know south wants me do. supposed manually edit auto-generated python migration file? if so, how -- don't see standard sql in file. instead, see this:

# changing field 'mytable.associated' db.alter_column(u'data_mytable', 'associated',      self.gf('django.db.models.fields.integerfield')() ) 

also, why didn't south pick on , add using clause automatically?

this dirty hack:

  1. manually added migraton removing offendig field i.e

migrations.removefield( model_name='name_of_the_model', name='offending_field', ) 2. changed operation of complaining migration alterfield addfield i.e

migrations.addfield(         model_name='name_of_model',         name='name_of_field',         field=models.foreignkey(blank=true, null=true, to='foreignkeymodel'),         preserve_default=false,     ), 

```


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -