Fixed #22611 -- Making SQL management commands migration aware.