User:MaxSem/Abstract schema

MediaWiki's upgrades system is currently in a seriously ugly state. While update.php works reasonably well for MySQL backend and is tested thoroughly during the alpha stage, it isn't the case for other database subsystems. They always have to chase MySQL (those updating the MySQL schema don't usually touch other parts of the updater). No matter how hard we try, present system of numerous DBMS-specific SQL patches is never going to work smoothly.

To address this, I'm thinking of revamping the way database schema is maintained.

Stage 1Edit

Passive information gathering. Each subsystem should have a set of functions that return full information about schema (currently only some pieces of schema are returned). Then a script should generate a schema description in a format suitable for comparison. This way, it would be trivial to detect simple problems such as missing table/column. Indexes are a trickier part as different databases could benefit from different indexes, and some "standard" indexes could impact write performance on different backends.

Stage 2Edit

All databases share the same updater logic. Initial tables don't necessarily need to be described by one same 'universal' SQL file, but updaters should be database-neutral (or at least there should be automatic translation from MySQL to all other dialects). Basically, this means that the present system of "we need field X on table Y, so run Z.sql if it's not present" should be changed to something like "we need field X of type Z on table Y, add it if needed".

Stage 3Edit


Stage 4Edit