[1.7.x] Fixed #23244: Error altering FK to non-FK in migrations