mirror of
https://github.com/django/django.git
synced 2025-10-29 08:36:09 +00:00
Improve migration optimizer to be able to optimize through other ops
This commit is contained in:
@@ -64,6 +64,18 @@ class Operation(object):
|
||||
"""
|
||||
return "%s: %s" % (self.__class__.__name__, self._constructor_args)
|
||||
|
||||
def references_model(self, name, app_label=None):
|
||||
"""
|
||||
Returns True if there is a chance this operation references the given
|
||||
model name (as a string), with an optional app label for accuracy.
|
||||
|
||||
Used for optimization. If in doubt, return True;
|
||||
returning a false positive will merely make the optimizer a little
|
||||
less efficient, while returning a false negative may result in an
|
||||
unusable optimized migration.
|
||||
"""
|
||||
return True
|
||||
|
||||
def __repr__(self):
|
||||
return "<%s %s%s>" % (
|
||||
self.__class__.__name__,
|
||||
|
||||
Reference in New Issue
Block a user