On Thu, Jul 24, 2014 at 2:22 PM, <gma...@apache.org> wrote: > Author: gmazza > Date: Thu Jul 24 18:22:11 2014 > New Revision: 1613234 > > URL: http://svn.apache.org/r1613234 > Log: > Tested migration process. Reactivated dropIndex commands (as they are > needed if they exist and one is dropping a column), however process changed > to now ignores any index-doesn't-exist errors. > > Modified: > > roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/startup/SQLScriptRunner.java > roller/trunk/app/src/main/resources/sql/500-to-510-migration.vm > > Modified: > roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/startup/SQLScriptRunner.java > URL: > http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/startup/SQLScriptRunner.java?rev=1613234&r1=1613233&r2=1613234&view=diff > > ============================================================================== > --- > roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/startup/SQLScriptRunner.java > (original) > +++ > roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/startup/SQLScriptRunner.java > Thu Jul 24 18:22:11 2014 > @@ -126,6 +126,10 @@ public class SQLScriptRunner { > successMessage(command); > > } catch (SQLException ex) { > + if (command.contains("drop foreign key") || > command.contains("drop index")) { > + errorMessage("INFO: SQL command [" + command + "] > failed, ignored."); > + continue; > + } > // add error message with text of SQL command to messages > errorMessage("ERROR: SQLException executing SQL [" + > command > + "] : " + ex.getLocalizedMessage()); >
I don't think this is a sufficient solution to the problem because many sys admins insist on doing database upgrades manually and do not trust automatic schema creation and update. The database creation script should be able to run on the command line without modification and without error. Is it critical that those indexes be deleted? - Dave