This is an automated email from the ASF dual-hosted git repository.
dill0wn pushed a commit to branch dw/solr_delete_history
in repository https://gitbox.apache.org/repos/asf/allura.git
The following commit(s) were added to refs/heads/dw/solr_delete_history by this
push:
new 6a491779e fully delete history snapshots when deleting artifacts (incl
remove from solr)
6a491779e is described below
commit 6a491779e91a85174a291d0f760a9395734d6793
Author: Dillon Walls <[email protected]>
AuthorDate: Fri Nov 10 16:11:23 2023 +0000
fully delete history snapshots when deleting artifacts (incl remove from
solr)
---
Allura/allura/model/artifact.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Allura/allura/model/artifact.py b/Allura/allura/model/artifact.py
index 3527b1d48..efb345739 100644
--- a/Allura/allura/model/artifact.py
+++ b/Allura/allura/model/artifact.py
@@ -705,9 +705,10 @@ class VersionedArtifact(Artifact):
def delete(self):
# remove history so that the snapshots aren't left orphaned
- super().delete()
HC = self.__mongometa__.history_class
- HC.query.remove(dict(artifact_id=self._id))
+ for version in HC.query.find(dict(artifact_id=self._id)):
+ version.delete()
+ super().delete()
@classmethod
def is_limit_exceeded(cls, *args, **kwargs):