Fix setting non-string initial data from a callable.

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

chipx86
Django Evolution
release-2.x
django-evolution

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.

Summary
Fix setting non-string initial data from a callable.
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.x (1cfc371)
Loading...