private static void migrateTreeConflictData(SVNSqlJetDb sDb) throws SVNException {
    SVNSqlJetStatement stmt =
        new SVNSqlJetSelectFieldsStatement<SVNWCDbSchema.ACTUAL_NODE__Fields>(
            sDb, SVNWCDbSchema.ACTUAL_NODE) {
          protected void defineFields() {
            fields.add(SVNWCDbSchema.ACTUAL_NODE__Fields.wc_id);
            fields.add(SVNWCDbSchema.ACTUAL_NODE__Fields.local_relpath);
            fields.add(SVNWCDbSchema.ACTUAL_NODE__Fields.tree_conflict_data);
          }

          protected boolean isFilterPassed() throws SVNException {
            return !isColumnNull(SVNWCDbSchema.ACTUAL_NODE__Fields.tree_conflict_data);
          }
        };
    /* Iterate over each node which has a set of tree conflicts, then insert all of them into the new schema.  */
    try {
      while (stmt.next()) {
        migrateSingleTreeConflictData(
            sDb,
            stmt.getColumnString(SVNWCDbSchema.ACTUAL_NODE__Fields.tree_conflict_data),
            stmt.getColumnLong(SVNWCDbSchema.ACTUAL_NODE__Fields.wc_id),
            SVNFileUtil.createFilePath(
                stmt.getColumnString(SVNWCDbSchema.ACTUAL_NODE__Fields.local_relpath)));
      }
    } finally {
      stmt.reset();
    }

    /* Erase all the old tree conflict data.  */
    stmt =
        new SVNSqlJetUpdateStatement(sDb, SVNWCDbSchema.ACTUAL_NODE) {
          public Map<String, Object> getUpdateValues() throws SVNException {
            Map<String, Object> rowValues = getRowValues();
            rowValues.put(SVNWCDbSchema.ACTUAL_NODE__Fields.tree_conflict_data.toString(), null);
            return rowValues;
          }
        };
    try {
      stmt.exec();
    } finally {
      stmt.reset();
    }
  }
  private static void upgradeExternals(SVNSqlJetDb sDb, File wcRootAbsPath) throws SVNException {
    SVNSqlJetStatement stmt = sDb.getStatement(SVNWCDbStatements.SELECT_EXTERNAL_PROPERTIES);
    SVNSqlJetStatement addStmt = sDb.getStatement(SVNWCDbStatements.INSERT_EXTERNAL);

    /* ### For this intermediate upgrade we just assume WC_ID = 1.
    ### Before this bump we lost track of externals all the time, so lets keep this easy. */
    stmt.bindf("is", 1, "");
    try {
      while (stmt.next()) {
        SVNProperties props = stmt.getColumnProperties(SVNWCDbSchema.NODES__Fields.properties);
        String externalsValues = props.getStringValue(SVNProperty.EXTERNALS);
        File localRelPath =
            SVNFileUtil.createFilePath(
                stmt.getColumnString(SVNWCDbSchema.NODES__Fields.properties));
        File localAbsPath = SVNFileUtil.createFilePath(wcRootAbsPath, localRelPath);

        if (externalsValues != null) {
          SVNExternal[] externalDefs = SVNExternal.parseExternals(localAbsPath, externalsValues);
          for (SVNExternal externalDef : externalDefs) {
            File externalPath = SVNFileUtil.createFilePath(localAbsPath, externalDef.getPath());

            /* Insert dummy externals definitions: Insert an unknown external, to make sure it will be cleaned up when it is not
            updated on the next update. */
            addStmt.bindf(
                "isssssis",
                1, /* wc_id*/
                SVNFileUtil.getFilePath(externalPath),
                SVNFileUtil.getFilePath(SVNFileUtil.getFileDir(externalPath)),
                "normal",
                "unknown",
                SVNFileUtil.getFilePath(localRelPath),
                1, /* repos_id */
                "" /* repos_relpath */);
            addStmt.exec();
          }
        }
      }
    } finally {
      stmt.reset();
    }
  }