Storing files with extension in database as BLOB
I think "user has one document" (and the others) is really a business rule - something you might need to change in the future, not a data rule. Therefore it should be enforced by triggers / constraints, not your schema

I'd go with a schema like this:

USERS -&lt; USER_DOCUMENTS &gt;- FILES

INVOICES -&lt; INVOICE_SCANS &gt;- FILES

BUILDINGS -&lt; BUILDING_PHOTOS &gt;- FILES

TRANSACTIONS -&lt; TRANSACTION_RECEIPTS &gt;- FILES


Where FILES looks like this:

FILES
file_id
content_type
name
data (BLOB)


While we're at it "transactions" is a very overused term in databases.