Fixed #23822 -- Added support for serializing model managers in migration

Thanks to Loïc Bistuer, Andrew Godwin, Carl Meyer, Simon Charette, Shai
Berger and others for their comments, review, help and input.