MT#63462 Remove duplicate prosody table entries

In some cases, the prosody.prosody table contains duplicated entries.
This causes the 15841.up migration script to fail when creating the
new index.

To prevent this, add a step before dropping/creating the index to
remove all duplicate rows from the table.

Change-Id: I912dd8484231689d5b1f3dc5087bb69a96c496eb
(cherry picked from commit 1bf0fbf03a)
(cherry picked from commit de7eb09ed5)
mr13.5.1
Jose Su 6 months ago committed by Jose Antonio Su Ng
parent e1afd49ac0
commit 006ad26e71

@ -1,6 +1,16 @@
USE prosody;
SET autocommit=0;
DELETE FROM prosody
WHERE (host, user, store, `key`, `value`) NOT IN (
SELECT t.host, t.user, t.store, t.`key`, t.max_value
FROM (
SELECT host, user, store, `key`, MAX(value) AS max_value
FROM prosody
GROUP BY host, user, store, `key`
) AS t
);
DROP INDEX prosody_index on prosody;
CREATE UNIQUE INDEX prosody_unique_index ON prosody(`host`(20), `user`(20), `store`(20), `key`(20)) USING BTREE;
COMMIT;

Loading…
Cancel
Save