Skip to content

Commit

Permalink
Adjust guide on tracking management commands (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleykendall authored Sep 2, 2024
1 parent 580eaa2 commit 398c8c2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ if __name__ == "__main__":
if (
len(sys.argv) > 1
and not sys.argv[1].startswith("runserver")
and not sys.argv[1] == "migrate"
):
# Group history context under the same management command if
# we aren't running a server.
Expand All @@ -87,6 +88,10 @@ if __name__ == "__main__":

Above we ignore tracking context for `runserver` commands. Otherwise every single change in a development session would be grouped under the same context.

!!! note

We also ignore `migrate`. Some custom schema-altering SQL can disrupt pghistory's context tracking. See [Issue #109](https://github.com/Opus10/django-pghistory/issues/109) for more information.

## Celery Tasks

Override the Celery base task to group all
Expand Down

0 comments on commit 398c8c2

Please sign in to comment.