mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
parent
24a8c528d0
commit
542a3f36a4
1 changed files with 25 additions and 1 deletions
|
@ -14,6 +14,7 @@ import org.asamk.signal.manager.storage.sessions.SessionStore;
|
|||
import org.asamk.signal.manager.storage.stickers.StickerStore;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.whispersystems.signalservice.api.push.ServiceId;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.Connection;
|
||||
|
@ -22,7 +23,7 @@ import java.sql.SQLException;
|
|||
public class AccountDatabase extends Database {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(AccountDatabase.class);
|
||||
private static final long DATABASE_VERSION = 12;
|
||||
private static final long DATABASE_VERSION = 13;
|
||||
|
||||
private AccountDatabase(final HikariDataSource dataSource) {
|
||||
super(logger, DATABASE_VERSION, dataSource);
|
||||
|
@ -304,5 +305,28 @@ public class AccountDatabase extends Database {
|
|||
""");
|
||||
}
|
||||
}
|
||||
if (oldVersion < 13) {
|
||||
logger.debug("Updating database: Cleanup unknown service ids");
|
||||
{
|
||||
final var sql = """
|
||||
DELETE FROM identity AS i
|
||||
WHERE i.uuid = ?
|
||||
""";
|
||||
try (final var statement = connection.prepareStatement(sql)) {
|
||||
statement.setBytes(1, ServiceId.UNKNOWN.toByteArray());
|
||||
statement.executeUpdate();
|
||||
}
|
||||
}
|
||||
{
|
||||
final var sql = """
|
||||
DELETE FROM sender_key_shared AS i
|
||||
WHERE i.uuid = ?
|
||||
""";
|
||||
try (final var statement = connection.prepareStatement(sql)) {
|
||||
statement.setBytes(1, ServiceId.UNKNOWN.toByteArray());
|
||||
statement.executeUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue