Whether the file is "deleted" from the database via the UPDATE or DELETE rows, the problem is the same: database operations + files are not atomic. Neither UPDATE nor DELETE are safer than others, these are both transactions in the database, while the file operation is not.
, . "", . , , , "". "" , , .
.
:
File Exists -- DB Record exists -- Truth
Yes No File does not exist
Yes Yes File does exist
No Yes File does exist, but its in error.
No No File does not exist
, .
, , .
, .
, , " ", 1.
, A-OK
, , , .
, .
, .
, - "", DB .
, " ", , , . , undefined, . , - .
DB .
, , - , , , -. , . ( ) , ..