I've just hit another problem related to custom fields. Currently migrations contain information about "rich" fields. If you use a custom field type, the migration code will currently import your field type from its Python module. This is highly problematic in case either the code moves or you later stop using that field type and want to remove the dependency.
I am currently in the process of rewriting some of my existing migrations by hand to replace all instances of a custom field type with the type it actually uses for storage. This will eventually allow me to drop the dependency but it's not very nice. Another problem is that for many custom field tapes makemigrations detects changes made to arguments that do no affect the database in any way (as they are returned by deconstruction). If we could ever break backwards compatibility, I'd suggest having field deconstruction only return the column type (and necessary arguments) it wants the schema editor to create. This would prevent the migrations from having external dependencies (which is a major win in itself). I'd also consider having apps.get_model() just use introspection to read the schema and return transient models with default field types for each underlying column type (so a custom JSONField would become a regular boring TextField inside migration code). This would save us tons of "rendering model states" time for the relatively small cost of having to cast certain columns to your preferred Python types inside a couple of data migrations. Cheers, -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CANw2pUG4quLkCUskBkTSoTLVVb7QsZVZgva0y4xOHui75_P1zA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.