Fix: stop full document saves from writing file path columns

A full save() of a Document instance loaded before another process moved its file wrote the old filename back. The DB then pointed at a path that no longer existed, and recovery only worked when the recomputed path happened to match the file's real location.

Document.save() now leaves filename and archive_filename out of full saves on existing rows. Writers that own those columns opt in with write_file_paths=True or an explicit update_fields. A full save of a row deleted elsewhere now raises instead of re-inserting it.
This commit is contained in:
stumpylog committed 2026-11-03 15:09:29 -08:00
1 parent fc29f3511f
commit 08748baf54
8 files changed
+152 -19

No files matched your search

+1 -1
View File
@@ -762,7 +762,7 @@ class ConsumerPlugin(
# Don't save with the lock active. Saving will cause the file
# renaming logic to acquire the lock as well.
# This triggers things like file renaming
document.save()
document.save(write_file_paths=True)
if document.root_document_id:
document_updated.send(