Delete from postgresql the documents' content when related rows deleted.
Other cleanups.