#28633: Migrate BooleanField to IntegerField
-------------------------------------------+------------------------
Reporter: Dmitriy Sintsov | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
It should be quite trivial and obvious that False is replaced to 0, while
True to 1. However SQLMIGRATE generated code
{{{
ALTER TABLE "isp_user_profile" ALTER COLUMN "is_filled" TYPE integer;
}}}
produces the following PostgreSQL error:
{{{
django.db.utils.ProgrammingError: column "is_filled" cannot be cast
automatically to type integer
HINT: You might need to specify "USING is_filled::integer".
}}}
Why USING statement is not generated automatically?
The workaround is to create RunSQL migration manually, but it would be
much more convenient to have correct SQL code generated automatically.
There is no data loss in direct conversion from boolean to integer.
--
Ticket URL: <https://code.djangoproject.com/ticket/28633>
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/057.ac758d7e95452c1ea45057321cf1a6c1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.