提交 b0f257fb authored 作者: christian.peter.io's avatar christian.peter.io

Automatic database upgrade from non page store is now possible

上级 9c3f53d7
......@@ -25,7 +25,7 @@ public class DbUpgrade {
static {
// static initialize block
nonPageStoreToCurrentEnabled = Utils.isClassPresent("org.h2.upgrade.v1_1_to_v1_2.Driver");
nonPageStoreToCurrentEnabled = Utils.isClassPresent("org.h2.upgrade.v1_1.Driver");
runningConversions = Collections.synchronizedMap(new Hashtable<String, DbUpgradeNonPageStoreToCurrent>(1));
}
......
......@@ -54,7 +54,7 @@ public class DbUpgradeNonPageStoreToCurrent {
private void init() throws SQLException {
try {
String oldStartUrlPrefix = (String) Utils.getStaticField("org.h2.upgrade.v1_1_to_v1_2.engine.Constants.START_URL");
String oldStartUrlPrefix = (String) Utils.getStaticField("org.h2.upgrade.v1_1.engine.Constants.START_URL");
oldUrl = url;
oldUrl = oldUrl.replaceAll(org.h2.engine.Constants.START_URL, oldStartUrlPrefix);
oldUrl = oldUrl.replaceAll(";IGNORE_UNKNOWN_SETTINGS=TRUE", "");
......@@ -62,7 +62,7 @@ public class DbUpgradeNonPageStoreToCurrent {
oldUrl = oldUrl.replaceAll(";IFEXISTS=TRUE", "");
oldUrl = oldUrl.replaceAll(";IFEXISTS=FALSE", "");
oldUrl += ";IGNORE_UNKNOWN_SETTINGS=TRUE";
Object ci = Utils.newInstance("org.h2.upgrade.v1_1_to_v1_2.engine.ConnectionInfo", oldUrl, info);
Object ci = Utils.newInstance("org.h2.upgrade.v1_1.engine.ConnectionInfo", oldUrl, info);
boolean isRemote = (Boolean) Utils.callMethod("isRemote", ci);
boolean isPersistent = (Boolean) Utils.callMethod("isPersistent", ci);
String dbName = (String) Utils.callMethod("getName", ci);
......@@ -120,7 +120,7 @@ public class DbUpgradeNonPageStoreToCurrent {
// "' to '" + newFile.getPath() + "' via '" + scriptFile.getPath()
// + "'");
Utils.callStaticMethod("org.h2.upgrade.v1_1_to_v1_2.Driver.load");
Utils.callStaticMethod("org.h2.upgrade.v1_1.Driver.load");
Connection connection = DriverManager.getConnection(oldUrl, info);
Statement stmt = connection.createStatement();
stmt.execute("script to '" + scriptFile + "'");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论