internal/postgres: update DeleteModule logic
internal/postgres: update DeleteModule logic

DeleteModule is updated to:

* Remove the DELETE from search_documents, since deleting rows from
  units will cascade to search_documents due to
  search_documents_unit_id_fkey

* Delete the module_path from the paths table if it no longer exists at
  any version in our database, which will also delete it from
  latest_module_versions.

Fixes golang/go#47748

Change-Id: If3b972fafbd42086c8c559b513630f6c12de6dba
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/342891
Trust: Julie Qiu <8d32267b6b4884cf35adeaccde2b6857ae11aace@golang.org>
Run-TryBot: Julie Qiu <8d32267b6b4884cf35adeaccde2b6857ae11aace@golang.org>
TryBot-Result: kokoro <2ac7b1f3fa578934c95181d4272be0d3bca00121@google.com>
Reviewed-by: Jonathan Amsterdam <e3d3698b2ccd5955e4adf250d0785062d0f9018b@google.com>

golang/pkgsite,golang/pkgsite,golang/pkgsite,golang/pkgsite