[1.7.x] Fixed #22568: Better proxy model support in migrations