]> nmode's Git Repositories - signal-cli/commitdiff
Add uniqueness check to db migration
authorAsamK <asamk@gmx.de>
Tue, 20 Feb 2024 10:03:15 +0000 (11:03 +0100)
committerAsamK <asamk@gmx.de>
Tue, 20 Feb 2024 10:03:32 +0000 (11:03 +0100)
lib/src/main/java/org/asamk/signal/manager/storage/AccountDatabase.java

index 014009c45fc42d7d7817c964042ec99c36206121..b1672f012d710179af483aee429688c7d4c26647 100644 (file)
@@ -556,7 +556,7 @@ public class AccountDatabase extends Database {
                                           profile_capabilities TEXT
                                         ) STRICT;
                                         INSERT INTO recipient2 (_id, aci, pni, storage_id, storage_record, number, username, unregistered_timestamp, profile_key, profile_key_credential, given_name, family_name, color, expiration_time, blocked, archived, profile_sharing, hidden, profile_last_update_timestamp, profile_given_name, profile_family_name, profile_about, profile_about_emoji, profile_avatar_url_path, profile_mobile_coin_address, profile_unidentified_access_mode, profile_capabilities)
-                                          SELECT r._id, (SELECT t.address FROM tmp_mapping_table t WHERE t.uuid = r.uuid AND t.address not like 'PNI:%') aci, (SELECT t.address FROM tmp_mapping_table t WHERE t.uuid = r.pni AND t.address like 'PNI:%') pni, storage_id, storage_record, number, username, unregistered_timestamp, profile_key, profile_key_credential, given_name, family_name, color, expiration_time, blocked, archived, profile_sharing, hidden, profile_last_update_timestamp, profile_given_name, profile_family_name, profile_about, profile_about_emoji, profile_avatar_url_path, profile_mobile_coin_address, profile_unidentified_access_mode, profile_capabilities
+                                          SELECT r._id, (SELECT t.address FROM tmp_mapping_table t WHERE t.uuid = r.uuid AND t.address not like 'PNI:%') aci, (SELECT t.address FROM tmp_mapping_table t WHERE t.uuid = r.pni AND t.address like 'PNI:%' AND t.address NOT IN (SELECT pni FROM recipient2)) pni, storage_id, storage_record, number, username, unregistered_timestamp, profile_key, profile_key_credential, given_name, family_name, color, expiration_time, blocked, archived, profile_sharing, hidden, profile_last_update_timestamp, profile_given_name, profile_family_name, profile_about, profile_about_emoji, profile_avatar_url_path, profile_mobile_coin_address, profile_unidentified_access_mode, profile_capabilities
                                           FROM recipient r;
                                         DROP TABLE recipient;
                                         ALTER TABLE recipient2 RENAME TO recipient;