One, of many available, which can be wrapped on a mediawiki-style api, if wanted:
Topic on User talk:Anomie/Abstract schema
Not necessarily to use as is, but maybe abstraction code can be copied, if it has a compatible license?
That looks potentially interesting, but at a first look through the documentation I see some potential issues:
- One thing I don't see in there is the ability to output SQL files for you to apply in a controlled manner on WMF sites. Or would you
- I suspect it'll want to use varchar and text rather than varbinary and blob for "string" and "text" columns.
- It doesn't have a generic "blob" column (it has one but mysql-only), which would seem to leave us no good option for storing compressed article text and such.
- And we'd have to figure out how to auto-translate MediaWiki's connection configuration into its syntax, or else have duplicate configuration.
As for copying, it looks to use an MIT license which should be compatible.
Phynx was just an example. I am afraid of doing everthing from 0, and not contribute or for to an existing project.
The --dry-run param on it supposedly prints the SQL to stdout instead of executing, so there's that. I need to take a deeper dive to see how customizable this is for our uses; my personal preference is that if we make use of a third-party library that we use the library directly instead of porting all the code over (and therefore taking on the maintenance burden of it ourselves)
The most popular such library is probably Doctrine (DBAL, more specifically).
Better link (leads directly to the bits talking about the schema abstraction). It appears that this is decoupled from the ORM, so it could be usable by us as well. Documentation is incomplete on their site, so we'd need to dig into the code in order to determine what does what.
It also looks like Doctrine builds on PDO behind-the-scenes. While not an insurmountable barrier, we don't use PDO in MediaWiki and would therefore have extra installation requirements if we were to make use of it.
They used to build on PDO, and the API tries to match the PDO API, but they have quite a few native drivers these days, including mysqli.