private static CommentHistoryAdapter upgrade(DBHandle dbHandle, AddressMap addrMap,
			CommentHistoryAdapter oldAdapter, TaskMonitor monitor)
			throws VersionException, IOException, CancelledException {

		AddressMap oldAddrMap = addrMap.getOldAddressMap();

		DBHandle tmpHandle = new DBHandle();
		try {
			tmpHandle.startTransaction();

			monitor.setMessage("Upgrading Comment History...");
			monitor.initialize(oldAdapter.getRecordCount() * 2);
			int count = 0;

			CommentHistoryAdapter tmpAdapter =
				new CommentHistoryAdapterV0(tmpHandle, addrMap, true);
			RecordIterator iter = oldAdapter.getAllRecords();
			while (iter.hasNext()) {
				monitor.checkCancelled();
				DBRecord rec = iter.next();
				Address addr = oldAddrMap.decodeAddress(rec.getLongValue(HISTORY_ADDRESS_COL));
				rec.setLongValue(HISTORY_ADDRESS_COL, addrMap.getKey(addr, true));
				tmpAdapter.updateRecord(rec);
				monitor.setProgress(++count);
			}

			dbHandle.deleteTable(COMMENT_HISTORY_TABLE_NAME);
			CommentHistoryAdapter newAdapter = new CommentHistoryAdapterV0(dbHandle, addrMap, true);

			iter = tmpAdapter.getAllRecords();
			while (iter.hasNext()) {
				monitor.checkCancelled();
				DBRecord rec = iter.next();
				newAdapter.updateRecord(rec);
				monitor.setProgress(++count);
			}
			return newAdapter;
		}
		finally {
			tmpHandle.close();
		}
	}
Adapter for accessing records in the CommentHistory table.
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/code/CommentHistoryAdapter.java