Skip to content

Commit

Permalink
Fixed DB migration
Browse files Browse the repository at this point in the history
  • Loading branch information
borichellow committed Oct 26, 2023
1 parent 1c5ee36 commit d149e33
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions persistence/src/commonMain/db_user/migrations/63.sqm
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ LEFT JOIN Call ON Call.id IS (SELECT id FROM Call WHERE Call.conversation_id = C
CREATE TRIGGER updateConversationProteusVerificationStatus
AFTER UPDATE ON Client
BEGIN
UPDATE Conversation SET proteus_verification_status = "VERIFIED"
UPDATE Conversation SET proteus_verification_status = (CASE (new.is_verified) WHEN 1 THEN "VERIFIED" ELSE "DEGRADED" END)
WHERE qualified_id IN (
SELECT id FROM (SELECT conv.qualified_id AS id, conv.proteus_verification_status AS verificationStatus, (COUNT(*) = SUM(CASE WHEN client.is_verified = 1 THEN 1 ELSE 0 END)) AS isActuallyVerified
FROM Conversation AS conv
Expand All @@ -125,7 +125,6 @@ BEGIN
AND mem.user IS NOT (SELECT SelfUser.id FROM SelfUser LIMIT 1)
GROUP BY conv.qualified_id)
WHERE (CASE (verificationStatus) WHEN "VERIFIED" THEN 1 ELSE 0 END) != isActuallyVerified

);
END;

Expand Down

0 comments on commit d149e33

Please sign in to comment.