Refs #23947 -- Improved migrations tests table cleanup.

Copied technique from schema tests.