9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-21 07:49:13 +00:00

fix: version_uuid instead of id in PSQL rotateSnapshots

This commit is contained in:
William
2024-09-29 13:35:28 +01:00
parent 4df7d2def4
commit cabde9e8d8

View File

@@ -329,7 +329,7 @@ public class PostgresDatabase extends Database {
try (Connection connection = getConnection()) { try (Connection connection = getConnection()) {
try (PreparedStatement statement = connection.prepareStatement(formatStatementTables(""" try (PreparedStatement statement = connection.prepareStatement(formatStatementTables("""
WITH cte AS ( WITH cte AS (
SELECT id SELECT version_uuid
FROM %user_data_table% FROM %user_data_table%
WHERE player_uuid=? WHERE player_uuid=?
AND pinned=FALSE AND pinned=FALSE
@@ -337,7 +337,7 @@ public class PostgresDatabase extends Database {
LIMIT %entry_count% LIMIT %entry_count%
) )
DELETE FROM %user_data_table% DELETE FROM %user_data_table%
WHERE id IN (SELECT id FROM cte);""".replace("%entry_count%", WHERE version_uuid IN (SELECT version_uuid FROM cte);""".replace("%entry_count%",
Integer.toString(unpinnedUserData.size() - maxSnapshots))))) { Integer.toString(unpinnedUserData.size() - maxSnapshots))))) {
statement.setObject(1, user.getUuid()); statement.setObject(1, user.getUuid());
statement.executeUpdate(); statement.executeUpdate();