1
0
mirror of https://github.com/django/django.git synced 2025-10-29 00:26:07 +00:00

Initial version of MigrationOptimizer and tests

This commit is contained in:
Andrew Godwin
2013-10-02 17:33:41 +01:00
parent 75bb6ba966
commit a80d9ab0fe
5 changed files with 237 additions and 0 deletions

View File

@@ -29,6 +29,14 @@ class AddField(Operation):
def describe(self):
return "Add field %s to %s" % (self.name, self.model_name)
def __eq__(self, other):
return (
(self.__class__ == other.__class__) and
(self.name == other.name) and
(self.model_name == other.model_name) and
(self.field.deconstruct()[1:] == other.field.deconstruct()[1:])
)
class RemoveField(Operation):
"""
@@ -92,6 +100,14 @@ class AlterField(Operation):
def describe(self):
return "Alter field %s on %s" % (self.name, self.model_name)
def __eq__(self, other):
return (
(self.__class__ == other.__class__) and
(self.name == other.name) and
(self.model_name == other.model_name) and
(self.field.deconstruct()[1:] == other.field.deconstruct()[1:])
)
class RenameField(Operation):
"""