fix(Core/Petitions): re-key petition_sign on petition_id and fix type-filtered signature deletes (#26668)

This commit is contained in:
Thierry PROST
2026-07-18 17:57:20 +02:00
committed by GitHub
parent df1c3ebdff
commit 47d6d2a48e
2 changed files with 13 additions and 2 deletions

View File

@@ -0,0 +1,10 @@
-- petition_sign kept its (petitionguid, playerguid) primary key when the
-- petition_id schema stopped writing petitionguid: every row inserts with
-- petitionguid = 0, so the key collapses to (0, playerguid) and a character
-- can never hold more than one signature row overall (later signs fail
-- silently with a duplicate key on the async insert).
-- Re-key on (petition_id, playerguid) and drop the signature rows orphaned
-- by the type-filtered deletes that no longer match (`type` is not written
-- by the insert either).
DELETE `ps` FROM `petition_sign` `ps` LEFT JOIN `petition` `p` ON `p`.`petition_id` = `ps`.`petition_id` WHERE `p`.`petition_id` IS NULL;
ALTER TABLE `petition_sign` DROP PRIMARY KEY, ADD PRIMARY KEY (`petition_id`, `playerguid`), DROP INDEX `idx_petition_id_player`;