(
self,
operation: Operation,
old_state: State,
new_state: State,
schema_editor: BaseSchemaEditor,
supports_transactions: bool,
)
| 137 | return state |
| 138 | |
| 139 | async def _run_database_forward( |
| 140 | self, |
| 141 | operation: Operation, |
| 142 | old_state: State, |
| 143 | new_state: State, |
| 144 | schema_editor: BaseSchemaEditor, |
| 145 | supports_transactions: bool, |
| 146 | ) -> None: |
| 147 | # Only wrap individual operations if schema editor is not already atomic. |
| 148 | # Never wrap in a transaction when collecting SQL — no real DB needed. |
| 149 | atomic_operation = operation.atomic or (self.atomic and operation.atomic is not False) |
| 150 | if ( |
| 151 | not schema_editor.collect_sql |
| 152 | and not schema_editor.atomic_migration |
| 153 | and atomic_operation |
| 154 | and supports_transactions |
| 155 | ): |
| 156 | async with in_transaction(schema_editor.client.connection_name): |
| 157 | await operation.database_forward( |
| 158 | self.app_label, old_state, new_state, schema_editor |
| 159 | ) |
| 160 | else: |
| 161 | await operation.database_forward(self.app_label, old_state, new_state, schema_editor) |
| 162 | |
| 163 | async def _run_database_backward( |
| 164 | self, |
no test coverage detected