Fixed issue with rename table in H2 for patches

This commit is contained in:
Rsl1122 2018-12-31 19:12:06 +02:00
parent bd4613339b
commit b0d1c442f3

View File

@ -128,10 +128,20 @@ public abstract class Patch {
}
protected void renameTable(String from, String to) {
String sql = dbType.supportsMySQLQueries() ?
"RENAME TABLE " + from + " TO " + to :
"ALTER TABLE " + from + " RENAME TO " + to;
db.execute(sql);
db.execute(getRenameTableSQL(from, to));
}
private String getRenameTableSQL(String from, String to) {
switch (dbType) {
case SQLITE:
return "ALTER TABLE " + from + " RENAME TO " + to;
case MYSQL:
return "RENAME TABLE " + from + " TO " + to;
case H2:
return "ALTER TABLE " + from + " RENAME TO " + to;
default:
throw new IllegalArgumentException("DBType: " + dbType.getName() + " does not have rename table sql");
}
}
protected UUID getServerUUID() {