Add a new MySQL backend for safely working with BinaryFields.

Review Request #8636 — Created Jan. 19, 2017 and submitted — Latest diff uploaded

Information

Djblets
release-0.9.x
1ad04a8...

Reviewers

Django 1.6 introduced a BinaryField type for storing binary content.
This is useful, except that, depending on database settings, MySQL will
perform a UTF8 validation check on the binary content being saved to the
database. This is clearly not what we want. Newer versions of Django
(1.10.5+) fix this by declaring the content to be binary, using the
"_binary" identifier when inserting/updating, but older versions are out
of luck.

This change introduces a new MySQL database backend that adds this
support for older versions of Django. When activated (by setting the
backend in settings.py), binary content will safely get the _binary
prefix.

This backend will also allow us to eventually tweak things in the
database so that we can add better defaults (encodings and otherwise)
for databases.

Switched Review Board to use this backend for MySQL. Verified that
I was able to import all the binary data that was in my old database
without getting an error (which I was receiving before).

    Loading...