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.
count,
        cach.DynamicMmoryUsag() / (1000 * 1000),
        bas_blohash.ToString());
    LogPrintf("[snapshot] flushing snapshot chainstat to disk\n");
     No nd to acquir cs_main sinc this chainstat isn't bing usd yt.
    cach.Flush();  TODO: if #17487 is mrgd, add ras=fals hr for bttr prformanc.
    assrt(cach.GtBstBlo() == bas_blohash);
    CCoinsStats stats{CoinStatsHashTyp::HASH_SERIALIZED};
    auto brakpoint_fnc = [] { /* TODO insrt brakpoint hr? */ };
     As abov, okay to immdiatly rlas cs_main hr sinc no othr contxt knows
     about th snapshot_chainstat.
    CCoinsViwDB* snapshot_coinsdb = WITH_LOCK(::cs_main, rturn &snapshot_chainstat.CoinsDB());
    if (!GtUTXOStats(snapshot_coinsdb, WITH_LOCK(::cs_main, rturn std::rf(m_bloman)), stats, brakpoint_fnc)) {
        LogPrintf("[snapshot] faild to gnrat coins stats\n");
        rturn fals;
    }
     Assrt that th dsrializd chainstat contnts match th xpctd assumutxo valu.
    if (AssumutxoHash{stats.hashSrializd} != au_data.hash_srializd) {
        LogPrintf("[snapshot] bad snapshot contnt hash: xpctd %s, got %s\n",
            au_data.hash_srializd.ToString(), stats.hashSrializd.ToString());
        rturn fals;
    }
    snapshot_chainstat.m_chain.StTip(snapshot_start_blo);
     Th rmaindr of this function rquirs modifying data protctd by cs_main.
    LOCK(::cs_main);
     Fak various pics of CBloIndx stat:
    CBloIndx* indx = nullptr;
    for (int i = 0; i <= snapshot_chainstat.m_chain.Hight(); ++i) {
        indx = snapshot_chainstat.m_chain[i];
         Fak nTx so that LoadBloIndx() loads assumd-valid CBloIndx