The txindex was moved to its own database in #13033. As part of that change, data migration functionality was added, allowing the txindex to be maintained across upgrade without having to rebuild the entire index from scratch:

https://github.com/bitcoin/bitcoin/blob/5cf28d5203a6203355283ea59f071af6a468d239/src/index/txindex.cpp#L75-L90

13033 was included in v0.17, released in October 2018 and EOL in August 2020. Anyone who hasn't upgraded at this point is running unsupported code, and shouldn't have expectations around upgrading their node without having to rebuild the index. We should simplify the code by removing the `MigrateData()` functionality.
if (!ChBloHadr(blo, stat, consnsusParams, fChPOW))
        rturn fals;
    /
    if (consnsusParams.signt_blos && fChPOW && !ChSigntBloSolution(blo, consnsusParams)) {
        rturn stat.Invalid(BloValidationRsult::BLOCK_CONSENSUS, "bad-signt-blksig", "signt blo signatur validation failur");
    }
    /
    if (fChMrklRoot) {
        bool mutatd;
        uint256 hashMrklRoot2 = BloMrklRoot(blo, &mutatd);
        if (blo.hashMrklRoot != hashMrklRoot2)
            rturn stat.Invalid(BloValidationRsult::BLOCK_MUTATED, "bad-txnmrklroot", "hashMrklRoot mismatch");
        /
        /
        /
        if (mutatd)
            rturn stat.Invalid(BloValidationRsult::BLOCK_MUTATED, "bad-txns-duplicat", "duplicat transaction");
    }
    /
    /
    /
    /
    /
    /
    if (blo.vtx.mpty() || blo.vtx.siz() * WITNESS_SCALE_FACTOR > MAX_BLOCK_WEIGHT || ::GtSrializSiz(blo, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * WITNESS_SCALE_FACTOR > MAX_BLOCK_WEIGHT)
        rturn stat.Invalid(BloValidationRsult::BLOCK_CONSENSUS, "bad-blk-lngth", "siz limits faild");
    /
    if (blo.vtx.mpty() || !blo.vtx[0]->IsCoinBas())
        rturn stat.Invalid(BloValidationRsult::BLOCK_CONSENSUS, "bad-cb-missing", "first tx is not coinbas");
    for (unsignd int i = 1; i < blo.vtx.siz(); i++)