deadlinecode / baileys-bottle

56 stars 40 forks source link

Fix: SQLITE ERROR On Group Create #19

Closed drauber closed 1 year ago

drauber commented 1 year ago

This change avoid the error

QueryFailedError: SQLITE_ERROR: ON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint

On create group.

drauber commented 1 year ago

This PR Fix the error:

query failed: INSERT INTO "chat"("DBId", "id", "messages", "newJid", "oldJid", "lastMsgTimestamp", "unreadCount", "readOnly", "endOfHistoryTransfer", "ephemeralExpiration", "ephemeralSettingTimestamp", "endOfHistoryTransferType", "conversationTimestamp", "name", "pHash", "notSpam", "archived", "disappearingMode", "unreadMentionCount", "markedAsUnread", "participant", "tcToken", "tcTokenTimestamp", "contactPrimaryIdentityKey", "pinned", "muteEndTime", "wallpaper", "mediaVisibility", "tcTokenSenderTimestamp", "suspended", "terminated", "createdAt", "createdBy", "description", "support", "isParentGroup", "isDefaultSubgroup", "parentGroupId", "displayName", "pnJid", "selfMasked", "mute", "pin", "archive", "dBAuthId") VALUES (NULL, ?, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ?, ?, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1) ON CONFLICT ( "id", "dBAuthId" ) DO UPDATE SET "id" = EXCLUDED."id", "dBAuthId" = EXCLUDED."dBAuthId", "conversationTimestamp" = EXCLUDED."conversationTimestamp", "name" = EXCLUDED."name" -- PARAMETERS: ["120363121219415541@g.us","1680548475","Atendimento Doug"]
deadlinecode commented 1 year ago

This makes DBAuth Unique which means that there can only be one chat for every Auth Session. This would break more than fix anything.

This should also be resolved in #16
If not please open a new Issue