Skip to content

Commit

Permalink
Explicitly delete SphinxDomain objects from previous versions
Browse files Browse the repository at this point in the history
This has to be done before deleting ImportedFiles and not with a cascade,
because multiple Domain's can reference a specific HTMLFile.
  • Loading branch information
ericholscher committed Jul 17, 2019
1 parent 0f47f05 commit c4876c7
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 @@ -1493,6 +1493,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 c4876c7

Please sign in to comment.