Feature summary (what you would like to be able to do and where):
The schema change to change UNIQUE INDEX to PRIMARY KEY generated from generateSchemaChangeSql.php on https://gerrit.wikimedia.org/r/c/mediawiki/extensions/ContentTranslation/+/817875 is not atomic and there could be a time gap, when the unique constraint is not active.
The DDL:
DROP INDEX cx_translation_translators ON /*_*/cx_translators; ALTER TABLE /*_*/cx_translators ADD PRIMARY KEY ( translator_user_id, translator_translation_id );
Better DDL:
ALTER TABLE /*_*/cx_translators DROP INDEX cx_translation_translators, ADD PRIMARY KEY ( translator_user_id, translator_translation_id );
Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):
This would provide DDL which is easier to use on production wikis like wmf wikis without the need from the DBA to rewrite/reorder the DDL
Benefits (why should this be implemented?):
Could be a upstream bug in the doctrine/dbal code.
It seems upstream MySQLPlatform::getPreAlterTableIndexForeignKeySQL can generate such an ALTER TABLE, but a new primary key is handled before that and added separately.
Currently used: "doctrine/dbal": "2.13.6||3.1.5"