Fix preUpdateSchema to support multiple version steps
The preUpdateSchema method ran too late when declared in schema version 81 and the installation was updating from version 79 through 80 to 81. During the 79->80 step gwtorm created missing tables and columns, failing to give version 81's preUpdateSchema method a chance to rename tables and columns from an old name to a new name. Run all intermediate preUpdateSchema methods before running the gwtorm black magic, then run migrateData after all current columns and tables are in place. Change-Id: Id5a9b5c7f39bd0e25a38cad37abaea2c7077a6ca
This commit is contained in:
		@@ -14,9 +14,6 @@
 | 
			
		||||
 | 
			
		||||
package com.google.gerrit.server.schema;
 | 
			
		||||
 | 
			
		||||
import com.google.gerrit.reviewdb.client.CurrentSchemaVersion;
 | 
			
		||||
import com.google.gerrit.reviewdb.server.ReviewDb;
 | 
			
		||||
import com.google.gwtorm.server.OrmException;
 | 
			
		||||
import com.google.inject.Inject;
 | 
			
		||||
import com.google.inject.Provider;
 | 
			
		||||
import com.google.inject.ProvisionException;
 | 
			
		||||
@@ -30,12 +27,4 @@ public class Schema_52 extends SchemaVersion {
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Override
 | 
			
		||||
  protected void upgradeFrom(UpdateUI ui, CurrentSchemaVersion curr,
 | 
			
		||||
      ReviewDb db, boolean toTargetVersion) throws OrmException {
 | 
			
		||||
    throw new OrmException("Cannot upgrade from schema " + curr.versionNbr
 | 
			
		||||
        + "; manually run init from Gerrit Code Review 2.1.7"
 | 
			
		||||
        + " and restart this version to continue.");
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user