#25002: Postgresql migration fails when changing a CharField to a TimeField
-------------------------------+--------------------
Reporter: dirkcuys | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
The code from the migration is as follows:
{{{#!python
migrations.AlterField(
model_name='studygroup',
name='time',
field=models.TimeField(),
),
}}}
The field used to be a models.CharField()
The error follows:
{{{
django.db.utils.ProgrammingError: column "time" cannot be cast
automatically to type time without time zone
HINT: Specify a USING expression to perform the conversion
}}}
I can manually fix this using SQL:
{{{
ALTER TABLE "studygroups_studygroup" ALTER COLUMN "time" TYPE time USING
"time"::time;
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25002>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.4f07fd06c681e2f61683a710d3b9d70a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.