mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-10-02 00:17:35 +02:00
Copy over uninstalled servers during db move
This is to preserve playtime of players who played on those servers Affects issues: - Fixed #2050
This commit is contained in:
parent
bb20dff61c
commit
8ab1f075e8
@ -44,6 +44,31 @@ public class ServerQueries {
|
|||||||
/* Static method class */
|
/* Static method class */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Query<Collection<Server>> fetchUninstalledServerInformation() {
|
||||||
|
String sql = SELECT + '*' + FROM + ServerTable.TABLE_NAME + WHERE + ServerTable.INSTALLED + "=?";
|
||||||
|
return new QueryStatement<Collection<Server>>(sql, 100) {
|
||||||
|
@Override
|
||||||
|
public void prepare(PreparedStatement statement) throws SQLException {
|
||||||
|
statement.setBoolean(1, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<Server> processResults(ResultSet set) throws SQLException {
|
||||||
|
Collection<Server> servers = new HashSet<>();
|
||||||
|
while (set.next()) {
|
||||||
|
servers.add(new Server(
|
||||||
|
set.getInt(ServerTable.SERVER_ID),
|
||||||
|
ServerUUID.fromString(set.getString(ServerTable.SERVER_UUID)),
|
||||||
|
set.getString(ServerTable.NAME),
|
||||||
|
set.getString(ServerTable.WEB_ADDRESS),
|
||||||
|
set.getBoolean(ServerTable.PROXY)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
return servers;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query database for all Plan server information.
|
* Query database for all Plan server information.
|
||||||
*
|
*
|
||||||
|
@ -84,6 +84,7 @@ public class BackupCopyTransaction extends RemoveEverythingTransaction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void copyPlanServerInformation() {
|
private void copyPlanServerInformation() {
|
||||||
|
copy(LargeStoreQueries::storeAllPlanServerInformation, ServerQueries.fetchUninstalledServerInformation());
|
||||||
copy(LargeStoreQueries::storeAllPlanServerInformation, ServerQueries.fetchPlanServerInformationCollection());
|
copy(LargeStoreQueries::storeAllPlanServerInformation, ServerQueries.fetchPlanServerInformationCollection());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user