Skip to content

Commit

Permalink
Merge pull request #5945 from readthedocs/fix-sphinxdomain-delete
Browse files Browse the repository at this point in the history
Explicitly delete SphinxDomain objects from previous versions
  • Loading branch information
ericholscher authored Jul 17, 2019
2 parents 2888d2e + b86b1b1 commit 5390828
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions readthedocs/projects/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1494,6 +1494,16 @@ def _sync_imported_files(version, build, changed_files):
build=build,
)

# Delete SphinxDomain objects from previous versions
# This has to be done before deleting ImportedFiles and not with a cascade,
# because multiple Domain's can reference a specific HTMLFile.
(
SphinxDomain.objects
.filter(project=version.project, version=version)
.exclude(build=build)
.delete()
)

# Delete ImportedFiles objects (including HTMLFiles)
# from the previous build of the version.
(
Expand Down

0 comments on commit 5390828

Please sign in to comment.