Fix setting non-string initial data from a callable.

Review Request #12278 — Created May 14, 2022 and submitted — Latest diff uploaded

Information

Django Evolution
release-2.x

Reviewers

When changing a field's NULL constraint from true to false and
setting the initial data, database evolver backends were assuming the
data being set could be injected directly into the query in the
database. This was often valid, but fell down for more complex types
(like dates/datetimes).

We now accept setting a string directly (for compatibility), but
anything else gets turned into a %s with the value going into the SQL
parameter list.

This ensures that the database layer can properly pass in the data type
in a way that the backend will like.

Unit tests pass for all versions of Django on all database types.

Commits

Files

    Loading...