File tree Expand file tree Collapse file tree
django/db/migrations/operations Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,6 +93,8 @@ def deconstruct(self):
9393 kwargs ["state_operations" ] = self .state_operations
9494 if self .hints :
9595 kwargs ["hints" ] = self .hints
96+ if self .elidable :
97+ kwargs ["elidable" ] = self .elidable
9698 return (self .__class__ .__qualname__ , [], kwargs )
9799
98100 @property
@@ -173,6 +175,8 @@ def deconstruct(self):
173175 kwargs ["atomic" ] = self .atomic
174176 if self .hints :
175177 kwargs ["hints" ] = self .hints
178+ if self .elidable :
179+ kwargs ["elidable" ] = self .elidable
176180 return (self .__class__ .__qualname__ , [], kwargs )
177181
178182 @property
Original file line number Diff line number Diff line change @@ -5543,6 +5543,10 @@ def test_run_sql(self):
55435543 elidable_operation = migrations .RunSQL ("SELECT 1 FROM void;" , elidable = True )
55445544 self .assertEqual (elidable_operation .reduce (operation , []), [operation ])
55455545
5546+ # Test elidable deconstruction
5547+ definition = elidable_operation .deconstruct ()
5548+ self .assertIs (definition [2 ]["elidable" ], True )
5549+
55465550 def test_run_sql_params (self ):
55475551 """
55485552 #23426 - RunSQL should accept parameters.
@@ -5796,6 +5800,10 @@ def create_shetlandponies(models, schema_editor):
57965800 elidable_operation = migrations .RunPython (inner_method , elidable = True )
57975801 self .assertEqual (elidable_operation .reduce (operation , []), [operation ])
57985802
5803+ # Test elidable deconstruction
5804+ definition = elidable_operation .deconstruct ()
5805+ self .assertIs (definition [2 ]["elidable" ], True )
5806+
57995807 def test_run_python_invalid_reverse_code (self ):
58005808 msg = "RunPython must be supplied with callable arguments"
58015809 with self .assertRaisesMessage (ValueError , msg ):
You can’t perform that action at this time.
0 commit comments