• 
      

    Don't try to apply defaults to certain database-specific field types.

    Review Request #12283 — Created May 16, 2022 and submitted — Latest diff uploaded

    Information

    Django Evolution
    release-2.x

    Reviewers

    On MySQL, text, blob, json, and the short/medium/long
    varieties of the first two are forbidden from having default values.

    Django Evolution would try to apply these anyway when adding a non-NULL
    field or changing a field to be non-NULL (and in fact validated that
    such a value would be provided when setting to non-NULL). This would
    prevent these types of fields from being added unless they were set to
    allow NULL.

    Now, the evolution op backends can override a
    get_field_type_allows_default() method, which can check a field to
    determine if default values should be allowed. This is used when
    building a column schema definition, ensuring that any DEFAULT-related
    SQL is omitted if not allowed for the field.

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

    Commits

    Files