private Map<Integer, OldVolume> getOldVolumes(final Connection connection) throws Exception {
        final Map<Integer, OldVolume> oldVolumes = new HashMap<>();

        final String selectVolumes = "" +
                "SELECT" +
                "  v.ID," +
                "  v.CRT_MS," +
                "  v.CRT_USER," +
                "  v.UPD_MS," +
                "  v.UPD_USER," +
                "  v.PATH," +
                "  v.IDX_STAT," +
                "  v.BYTES_LMT," +
                "  n.NAME," +
                "  vs.BYTES_USED," +
                "  vs.BYTES_FREE," +
                "  vs.BYTES_TOTL," +
                "  vs.STAT_MS " +
                " FROM OLD_VOL v" +
                " JOIN OLD_ND n ON (n.ID = v.FK_ND_ID)" +
                " JOIN OLD_VOL_STATE vs ON (vs.ID = v.FK_VOL_STATE_ID)";

        try (final PreparedStatement select = connection.prepareStatement(selectVolumes)) {
            try (final ResultSet resultSet = select.executeQuery()) {
                while (resultSet.next()) {
                    final int volId = resultSet.getInt(1);
                    final Long crtMs = DbUtil.getLong(resultSet, 2);
                    final String crtUser = resultSet.getString(3);
                    final Long updMs = DbUtil.getLong(resultSet, 4);
                    final String updUser = resultSet.getString(5);
                    final String path = resultSet.getString(6);
                    final byte state = resultSet.getByte(7);
                    final Long bytesLimit = DbUtil.getLong(resultSet, 8);
                    final String node = resultSet.getString(9);
                    final Long bytesUsed = DbUtil.getLong(resultSet, 10);
                    final Long bytesFree = DbUtil.getLong(resultSet, 11);
                    final Long bytesTotal = DbUtil.getLong(resultSet, 12);
                    final Long statMs = DbUtil.getLong(resultSet, 13);

                    oldVolumes.put(volId, new OldVolume(
                            volId,
                            crtMs,
                            crtUser,
                            updMs,
                            updUser,
                            path,
                            VolumeUseStatus.PRIMITIVE_VALUE_CONVERTER.fromPrimitiveValue(state),
                            bytesLimit,
                            node,
                            bytesUsed,
                            bytesFree,
                            bytesTotal,
                            statMs));
                }
            }
        }

        return oldVolumes;
    }
@return A map of index UUIDs to lists of the volumes they use. We'll need both, hence the map.
stroom-legacy/stroom-legacy-db-migration/src/main/java/stroom/legacy/db/migration/V07_00_00_1502__Index.java