Beispiel #1
0
 private List<SchemaVersion> pending(int curr) {
   List<SchemaVersion> r = Lists.newArrayListWithCapacity(versionNbr - curr);
   for (SchemaVersion v = this; curr < v.getVersionNbr(); v = v.prior.get()) {
     r.add(v);
   }
   Collections.reverse(r);
   return r;
 }
Beispiel #2
0
 private void migrateData(
     List<SchemaVersion> pending, UpdateUI ui, CurrentSchemaVersion curr, ReviewDb db)
     throws OrmException, SQLException {
   for (SchemaVersion v : pending) {
     ui.message(String.format("Migrating data to schema %d ...", v.getVersionNbr()));
     v.migrateData(db, ui);
     v.finish(curr, db);
   }
 }
Beispiel #3
0
  private void updateSchema(List<SchemaVersion> pending, UpdateUI ui, ReviewDb db)
      throws OrmException, SQLException {
    for (SchemaVersion v : pending) {
      ui.message(String.format("Upgrading schema to %d ...", v.getVersionNbr()));
      v.preUpdateSchema(db);
    }

    JdbcSchema s = (JdbcSchema) db;
    try (JdbcExecutor e = new JdbcExecutor(s)) {
      s.updateSchema(e);
    }
  }