[1.7.x] Fixed #23316 -- Added datetime.time serialization in migrations.

Backport of 11d9cbe2f4 from master