From dc58593af1d147bd06cb62b02f2d27459cc7f01e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabio=20R=C3=A4mi?= Date: Thu, 3 Oct 2019 08:00:32 +0200 Subject: [PATCH] docs(history): document cleanup commands in README This commit adds a section about cleanup commands for historical records to the README.md. Drive-by typo fix in command test. --- README.md | 6 ++++++ caluma/form/tests/test_command.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 339fcd5db..530e0ca6c 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,12 @@ If you wish to expose an API for querying previous revisions of documents, you n If you enable this, make sure to also configure [visibilities](#visibility-classes) and [permissions](#permission-classes) for historical types. +##### Cleanup +You may want to periodically cleanup the historical records. There are two commands available for this: + + - `clean_duplicate_history`: Historical records are always created when `save()` has been called on a model. This command removes all duplicates. + - `cleanup_history`: Remove all historical records, or the ones that are older than specified. + #### FormatValidators FormatValidator classes can validate input data for answers, based on rules set on the question. diff --git a/caluma/form/tests/test_command.py b/caluma/form/tests/test_command.py index a3421e97d..7dcd84436 100644 --- a/caluma/form/tests/test_command.py +++ b/caluma/form/tests/test_command.py @@ -21,7 +21,7 @@ def test_create_bucket_command(mocker): @pytest.mark.parametrize("dry", [True, False]) @pytest.mark.parametrize("keep,kept", [("1 year", 2), ("1 day", 1), (None, 0)]) def test_cleanup_history_command(db, dry, keep, kept): - # we need to override the rehistered models dict in order to get rid of the + # we need to override the registered models dict in order to get rid of the # fake models created in core tests cleanup_history.registered_models = { k: v for k, v in registered_models.items() if not k.startswith("core_")