Page MenuHomePhabricator

Math table doesn't have a PK
Closed, ResolvedPublic

Description

Might want to be tidied up, see bug 15441


Version: unspecified
Severity: minor

Details

Reference
bz33638

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.
StatusSubtypeAssignedTask
ResolvedLSobanski
DeclinedNone
ResolvedNone

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:05 AM
bzimport set Reference to bz33638.

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 there

really 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 there

really 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