Changeset 5883


Ignore:
Timestamp:
Nov 22, 2011, 12:00:03 PM (10 years ago)
Author:
Nicklas Nordborg
Message:

References #1630: Migrate from MySQL to PostgreSQL

Changed the export to skip exporting data if the file already exists. The main reason is to be able to create another export for a single table that has failed to be imported (eg. the '0'-value problem mentioned in [5882]) without having to run a full export.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/Migration.java

    r5882 r5883  
    305305      nextTick = System.currentTimeMillis()+TICK_INTERVAL;
    306306
     307      long approxRows = table.getRowCount(engine, connection, true);
     308      File exportFile = getDataFile(table);
     309      if (exportFile.exists())
     310      {
     311        // Skip this table and move on to the next
     312        actualExported += approxRows;
     313        progress.display((int)((actualExported * 100) / approxTotal),
     314            tableName + ": skipped (file already exists)\n");
     315        continue; // with next table
     316      }
     317     
    307318      // Get columns in sorted order
    308319      SortedSet<ColumnInfo> columns =  new TreeSet<ColumnInfo>();
     
    330341
    331342      // Create output file
    332       File exportFile = getDataFile(table);
    333343      writer = new BufferedWriter(
    334344          new OutputStreamWriter(FileUtil.getOutputStream(exportFile), "UTF-8"));
    335345
    336       long approxRows = table.getRowCount(engine, connection, true);
    337346      ResultSet rows = st.executeQuery(select.toString());
    338347      int actualRows = 0;
Note: See TracChangeset for help on using the changeset viewer.