fix: migrations

This commit is contained in:
Davidson Gomes
2024-08-15 13:13:08 -03:00
parent 285a950c67
commit 975f41d58e
7 changed files with 153 additions and 107 deletions

View File

@@ -4,5 +4,14 @@
- A unique constraint covering the columns `[remoteJid,instanceId]` on the table `Contact` will be added. If there are existing duplicate values, this will fail.
*/
-- Remove the duplicates
DELETE FROM "Contact"
WHERE ctid NOT IN (
SELECT min(ctid)
FROM "Contact"
GROUP BY "remoteJid", "instanceId"
);
-- CreateIndex
CREATE UNIQUE INDEX "Contact_remoteJid_instanceId_key" ON "Contact"("remoteJid", "instanceId");