The deal here is that the model Currency has an ID, which is well, integer.
Your data that is already on that column, is char (original field). If you are not in production, I would recommend dropping the field (comment the code), make migrations and apply. that will remove the currency column. Then add the new column, make migrations and apply.On Fri, Feb 20, 2015 at 2:30 PM, Martin Kapfhammer <mart.kapfhammer@gmail.com> wrote:
--First I created a CharField:('currency', models.CharField(max_length=30)),In a later migration I changed it to a foreign key field:field=models.ForeignKey(to='web.Currency'),It worked on a local MySql instance, but not on Postgres on Heroku:django.db.utils.ProgrammingError: column "currency_id" cannot be cast automatically to type integerHINT: Specify a USING expression to perform the conversion.If I do the following manually, I can continue:alter table web_financialdata drop column currency;
alter table web_financialdata add column currency integer;Should I add this via RunSQL between the migrations. If so, how? Or is there a better way?Thanks,Martin
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bdde39c8-a81a-4228-bb68-cbebb675d729%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
George R. C. Silva
SIGMA Consultoria
SIGMA Consultoria
----------------------------
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGyPVTvn%3Dt_fLsKTvG9e13UNbWOkj71TMgDKizVQcnU2UBnc6w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment