Might want to be tidied up, see bug 15441
Version: unspecified
Severity: minor
Might want to be tidied up, see bug 15441
Version: unspecified
Severity: minor
Status | Subtype | Assigned | Task | |
---|---|---|---|---|
· · · | ||||
Resolved | LSobanski | T17441 Some tables lack unique or primary keys, may allow confusing duplicate data | ||
Declined | None | T73975 Release Math 2.1 | ||
Resolved | None | T35638 Math table doesn't have a PK | ||
· · · |
But it has a unique index on math_inputhash
So effectively works the same...
RESOLVED WFM?
I think having an explicit primary key on a table has merits for someone working directly on the database without having to look at the code.
Hmmm. Glancing at includes/installer/DatabaseUpdater.php & Co., is there really no option to "promote" an index? Dropping and creating would certainly work, but would generate unnecessary load.
(In reply to comment #2)
I think having an explicit primary key on a table has merits for someone
working directly on the database without having to look at the code.Hmmm. Glancing at includes/installer/DatabaseUpdater.php & Co., is therereally no option to "promote" an index? Dropping and creating would certainly
work, but would generate unnecessary load.
Does MySQL etc have the support to do that?
ALTER TABLE MODIFY INDEX or something?
(In reply to comment #2)
I think having an explicit primary key on a table has merits for someone
working directly on the database without having to look at the code.Hmmm. Glancing at includes/installer/DatabaseUpdater.php & Co., is therereally no option to "promote" an index? Dropping and creating would certainly
work, but would generate unnecessary load.
And if we decide (and find a "cheap" way) on a way, there are numerous others that should probably be updated similarly see bug 15441
mails2vichu wrote:
DatabaseUpdater.php
This file is not sufficient I think.There has to be some other way.
Can anyone help me for fixing this?
(In reply to comment #5)
DatabaseUpdater.php
This file is not sufficient I think.There has to be some other way.
Can anyone help me for fixing this?
What? That's how you need to do it; this is pretty simple to fix.
Math already has a database update hook in place:
$wgHooks['LoadExtensionSchemaUpdates'][] = 'MathHooks::onLoadExtensionSchemaUpdates';
So then you only need to create a .sql file with the addition of the primary key, add it to git, and in the same revision edit Math.hooks.php and add a line to make the new sql file be processed to add the new column.
Then also update the other base sql files to add the new column when creating the table initially
physik wrote:
Fixed in https://gerrit.wikimedia.org/r/#/c/134326/
I don't think that we need to update exisiting Math tables