Fixed #23474 -- Prevented migrating backwards from unapplying the wrong migrations.