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
mr14.0.1
Jose Su 1 month ago
parent 5a33a658ea
commit 1bf0fbf03a

@ -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