Opened 9 years ago

Last modified 8 years ago

#26586 closed Bug

makemigrations does not detect custom field subclassing change — at Version 3

Reported by: Phil Krylov Owned by: nobody
Component: Migrations Version: 1.9
Severity: Normal Keywords: migrations, custom fields
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tobin Brown)

Example:

class MyLongTextField(models.CharField):
    def __init__(self, *args, **kwargs):
        kwargs["max_length"] = 2000
        super(MyLongTextField, self).__init__(*args, **kwargs)

After changing this to

class MyLongTextField(models.TextField):
    def __init__(self, *args, **kwargs):
        kwargs["max_length"] = 2000
        super(MyLongTextField, self).__init__(*args, **kwargs)

manage.py makemigrations detects no changes.

Change History (3)

comment:1 by Tim Graham, 9 years ago

Triage Stage: UnreviewedAccepted

I'm not sure how to handle this.

comment:2 by Phil Krylov, 9 years ago

I think that expected behaviour is to generate an ALTER TABLE table_name ALTER COLUMN column_name TYPE TEXT migration operation. However, I'm not familiar enough with migration internals to predict what it takes to detect a change like this.

comment:3 by Tobin Brown, 9 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top