roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r730747 - in /roller/branches/roller_4.0/apps/weblogger/src: java/org/apache/roller/weblogger/business/startup/ sql/
Date Fri, 02 Jan 2009 15:03:29 GMT
Author: snoopdave
Date: Fri Jan  2 07:03:29 2009
New Revision: 730747

URL: http://svn.apache.org/viewvc?rev=730747&view=rev
Log:
Adding 4.0.1 database upgrade script with comment that "no database changes in version 401,
but we did record the new version number." 

Added:
    roller/branches/roller_4.0/apps/weblogger/src/sql/400-to-401-migration.vm
Modified:
    roller/branches/roller_4.0/apps/weblogger/src/java/org/apache/roller/weblogger/business/startup/DatabaseInstaller.java
    roller/branches/roller_4.0/apps/weblogger/src/java/org/apache/roller/weblogger/business/startup/SQLScriptRunner.java
    roller/branches/roller_4.0/apps/weblogger/src/sql/dbscripts.properties

Modified: roller/branches/roller_4.0/apps/weblogger/src/java/org/apache/roller/weblogger/business/startup/DatabaseInstaller.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0/apps/weblogger/src/java/org/apache/roller/weblogger/business/startup/DatabaseInstaller.java?rev=730747&r1=730746&r2=730747&view=diff
==============================================================================
--- roller/branches/roller_4.0/apps/weblogger/src/java/org/apache/roller/weblogger/business/startup/DatabaseInstaller.java
(original)
+++ roller/branches/roller_4.0/apps/weblogger/src/java/org/apache/roller/weblogger/business/startup/DatabaseInstaller.java
Fri Jan  2 07:03:29 2009
@@ -245,6 +245,10 @@
                 upgradeTo400(con, runScripts);
                 dbversion = 400;
             }
+            if(dbversion < 401) {
+                upgradeTo401(con, runScripts);
+                dbversion = 401;
+            }
 
             // make sure the database version is the exact version
             // we are upgrading too.
@@ -1189,6 +1193,32 @@
     }
     
     
+    /**
+     * Upgrade database for Roller 4.0.1
+     */
+    private void upgradeTo401(Connection con, boolean runScripts) throws StartupException
{
+        SQLScriptRunner runner = null;
+        try {
+            if (runScripts) {
+                String handle = getDatabaseHandle(con);
+                String scriptPath = handle + "/400-to-401-migration.sql";
+                successMessage("Running database upgrade script: "+scriptPath);
+                runner = new SQLScriptRunner(scripts.getDatabaseScript(scriptPath));
+                runner.runScript(con, true);
+                messages.addAll(runner.getMessages());
+            }
+        } catch (Exception e) {
+            log.error("ERROR running 401 database upgrade script", e);
+            if (runner != null) messages.addAll(runner.getMessages());
+
+            errorMessage("Problem upgrading database to version 401", e);
+            throw new StartupException("Problem upgrading database to version 401", e);
+        }
+
+        updateDatabaseVersion(con, 310);
+    }
+
+
     private int parseVersionString(String vstring) {        
         int myversion = 0;
         

Modified: roller/branches/roller_4.0/apps/weblogger/src/java/org/apache/roller/weblogger/business/startup/SQLScriptRunner.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0/apps/weblogger/src/java/org/apache/roller/weblogger/business/startup/SQLScriptRunner.java?rev=730747&r1=730746&r2=730747&view=diff
==============================================================================
--- roller/branches/roller_4.0/apps/weblogger/src/java/org/apache/roller/weblogger/business/startup/SQLScriptRunner.java
(original)
+++ roller/branches/roller_4.0/apps/weblogger/src/java/org/apache/roller/weblogger/business/startup/SQLScriptRunner.java
Fri Jan  2 07:03:29 2009
@@ -77,7 +77,9 @@
                 } else {
                     command += " "; // still more command coming so add space
                 }
-            } 
+            } else {
+                successMessage(line);
+            }
         }
         in.close();    
     }

Added: roller/branches/roller_4.0/apps/weblogger/src/sql/400-to-401-migration.vm
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0/apps/weblogger/src/sql/400-to-401-migration.vm?rev=730747&view=auto
==============================================================================
--- roller/branches/roller_4.0/apps/weblogger/src/sql/400-to-401-migration.vm (added)
+++ roller/branches/roller_4.0/apps/weblogger/src/sql/400-to-401-migration.vm Fri Jan  2 07:03:29
2009
@@ -0,0 +1,7 @@
+#** 
+400-to-401-migration.vm: Velocity template that generates vendor-specific database scripts
+
+DON'T RUN THIS, IT'S NOT A DATABASE CREATION SCRIPT!!!
+**#
+
+-- No database changes in version 401, but we did record the new version number
\ No newline at end of file

Modified: roller/branches/roller_4.0/apps/weblogger/src/sql/dbscripts.properties
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0/apps/weblogger/src/sql/dbscripts.properties?rev=730747&r1=730746&r2=730747&view=diff
==============================================================================
--- roller/branches/roller_4.0/apps/weblogger/src/sql/dbscripts.properties (original)
+++ roller/branches/roller_4.0/apps/weblogger/src/sql/dbscripts.properties Fri Jan  2 07:03:29
2009
@@ -7,5 +7,5 @@
 # list all db templates to generate, separated by spaces
 templates=createdb 200-to-210-migration 210-to-230-migration \
 230-to-240-migration 240-to-300-migration 300-to-310-migration \
-310-to-400-migration,310-to-401-migration
+310-to-400-migration 400-to-401-migration
 



Mime
View raw message