On 20/04/12 23:27, Greg Sabino Mullane wrote:
Right. I've been thinking about this a lot, and the big picture plan is to remove all the tables.sql files and create a single text file, mediawiki.schema, which will have a generic schema, very similar to the existing main tables.sql, but with a stricter syntax and more generic definitions. This will be parsed and put into a php structure. Each database will walk through this structure to build it's own 'create' statements, using common methods and attributes whenever possible. Similarly, we can use this for updates as well by simply walking through and adding missing tables, rather than having to create patch files or other shenanigans. Most of the above is written: the tricky part is actually figuring out exactly what the intent of each column definition in the current tables.sql is! There is a lack of consistency and some questionable choices. This will also be a great time to introduce some standards, e.g. naming of indexes.
Note we will also need a way to generate a SQL from that (eg. for manually creating a new database with SQLAdmin).
Personally, I prefer viewing the code (SQL) which is really used, but I won't stop you from making the perfect abstraction.