mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-26 10:01:23 +01:00
Fix RemoveUsernameFromAccessLogPatch applying every time
This commit is contained in:
parent
7a582c3b6e
commit
bacde53781
@ -20,6 +20,11 @@ import com.djrapitops.plan.storage.database.DBType;
|
||||
import com.djrapitops.plan.storage.database.sql.building.CreateTableBuilder;
|
||||
import com.djrapitops.plan.storage.database.sql.building.Sql;
|
||||
|
||||
/**
|
||||
* Represents plan_access_log table.
|
||||
*
|
||||
* @see com.djrapitops.plan.storage.database.transactions.patches.RemoveUsernameFromAccessLogPatch
|
||||
*/
|
||||
public class AccessLogTable {
|
||||
|
||||
public static final String TABLE_NAME = "plan_access_log";
|
||||
|
@ -28,6 +28,8 @@ import java.sql.Types;
|
||||
import static com.djrapitops.plan.storage.database.sql.building.Sql.*;
|
||||
|
||||
/**
|
||||
* Sets username fields to NULL in plan_access_log table.
|
||||
*
|
||||
* @author AuroraLS3
|
||||
*/
|
||||
public class RemoveUsernameFromAccessLogPatch extends Patch {
|
||||
@ -37,7 +39,10 @@ public class RemoveUsernameFromAccessLogPatch extends Patch {
|
||||
if (!hasColumn(AccessLogTable.TABLE_NAME, "username")) {
|
||||
return true;
|
||||
}
|
||||
return !hasUsernames();
|
||||
}
|
||||
|
||||
private Boolean hasUsernames() {
|
||||
String sql = SELECT + "COUNT(*) as c" +
|
||||
FROM + AccessLogTable.TABLE_NAME +
|
||||
WHERE + "username" + IS_NOT_NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user