Fixes #23799 squashmigrations optimize conditionally