Fixed #21280 -- Don't generate empty migration files

Hi,

A simple fix to avoid empty migration file in case of an error in generating the migration content.

Thanks,
Javed