#22436: migrations fail on custom upload_to on ImageField
-------------------------------------+-------------------------------------
Reporter: David Binetti | Owner:
<dbinetti@…> | chriscauley
Type: Bug | Status: assigned
Component: Migrations | Version: master
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by andrewgodwin):
chriscauley: The contract is more precise than that; when fields are used
in a migration you're guaranteeing that they'll be backwards-compatible
for as long as the migration exists. That's easy enough for Django itself,
especially now we have tools to let you reset migrations and remove old
declarations; you'd be able to easy move from your 425 to just a few new
initial ones.
Migrations just being for the database is also not true; as we support
data migrations we need to support all arguments, even those which seem
useless at first (e.g. upload_to, validators). These fields are needed to
have the field truly represented in the migration, otherwise a migration
that added new rows wouldn't be able to do it properly.
Plus, what if a subclass of FileField actually uses upload_to to affect
the database? We can't rule it out for everything.
It's painful, but we've got literally everything else in Django working
well in this regard, pointers to functions on classes is one of the very
few missing things - your suggested use of `six.get_qualname` seems
sensible and I'll investigate it in a bit.
--
Ticket URL: <https://code.djangoproject.com/ticket/22436#comment:11>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/092.0f7455c677c4ea0993a147dc48377c8b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.