MCPcopy
hub / github.com/django/django / reduce

Method reduce

django/db/migrations/operations/fields.py:257–271  ·  view source on GitHub ↗
(self, operation, app_label)

Source from the content-addressed store, hash-verified

255 return "alter_%s_%s" % (self.model_name_lower, self.name_lower)
256
257 def reduce(self, operation, app_label):
258 if isinstance(
259 operation, (AlterField, RemoveField)
260 ) and self.is_same_field_operation(operation):
261 return [operation]
262 elif (
263 isinstance(operation, RenameField)
264 and self.is_same_field_operation(operation)
265 and self.field.db_column is None
266 ):
267 return [
268 operation,
269 replace(self, name=operation.new_name),
270 ]
271 return super().reduce(operation, app_label)
272
273
274class RenameField(FieldOperation):

Callers

nothing calls this directly

Calls 3

replaceFunction · 0.90
reduceMethod · 0.45

Tested by

no test coverage detected