1
0
mirror of https://github.com/django/django.git synced 2025-10-28 16:16:12 +00:00

Massive migration optimiser improvements + RenameModel opn

This commit is contained in:
Andrew Godwin
2013-11-06 13:47:58 +00:00
parent 8265323c91
commit 106b019dc9
7 changed files with 520 additions and 19 deletions

View File

@@ -9,6 +9,9 @@ class Operation(object):
Note that some operations won't modify memory state at all (e.g. data
copying operations), and some will need their modifications to be
optionally specified by the user (e.g. custom Python code snippets)
Due to the way this class deals with deconstruction, it should be
considered immutable.
"""
# If this migration can be run in reverse.
@@ -76,6 +79,15 @@ class Operation(object):
"""
return True
def references_field(self, model_name, name, app_label=None):
"""
Returns True if there is a chance this operation references the given
field name, with an optional app label for accuracy.
Used for optimization. If in doubt, return True.
"""
return self.references_model(model_name, app_label)
def __repr__(self):
return "<%s %s%s>" % (
self.__class__.__name__,