Drop stale records in TableMetadata and improve trigger definition

Trigger definition improvements:
 - also run on DELETE actions
 - drop any previously existing trigger by the same name