mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-09 09:57:35 +01:00
Fixed issue with rename table in H2 for patches
This commit is contained in:
parent
bd4613339b
commit
b0d1c442f3
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user