Skip to content

Commit 72c52c7

Browse files
committed
docs: refine rationale for rejecting pre_save in migration logic
1 parent c55800c commit 72c52c7

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

docs/decisions/0013-course-authoring-automatic-migration.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,10 @@ Rejected Alternatives
249249
*********************
250250

251251
**Using pre_save to trigger the migration**
252-
A ``pre_save`` handler could detect the transition direction and execute the migration
253-
before the flag change is written. This approach violates ACID principles: at the moment
254-
``pre_save`` fires, the new flag value has not yet been committed to the database. If the
255-
subsequent ``save()`` were to fail (e.g., a validation error, a database constraint
256-
violation, or a network issue), the migration would have already run against a state that
257-
was never persisted, leaving the permission data inconsistent with the actual flag value.
252+
The use of pre_save signals was discarded because they depend on a state transition
253+
that has not yet been committed to the database. Operating before persistence assumes
254+
a future-valid state that may not materialize. post_save was preferred to ensure
255+
migration logic operates only on confirmed states.
258256

259257
**Asynchronous execution via Celery**
260258
Given that automatic migration is scoped to course-level and organization-level

0 commit comments

Comments
 (0)