python - django migrate has error: Specify a USING expression to perform the conversion -
i change model field charfiled() genericipaddressfield()
ip = models.genericipaddressfield()
and use django 1.7 migrate
./manage.py makemigrations core ./manage.py migrate
but there error:
return self.cursor.execute(sql, params) django.db.utils.programmingerror: column "ip" cannot cast automatically type inet hint: specify using expression perform conversion.
i try this,but not work:
alter table core_message alter column ip type inet using (ip::inet);
error:
error: invalid input syntax type inet: ""
what can now?
please me thank you!
one quick fix drop , create field:
- delete migration changing field type.
- delete/comment field
ip
- make migrations
- get back/uncomment field
ip
new field type - make migrations
- migrate
i did in production , restored data previous csv backup , python script of few lines code.
Comments
Post a Comment