generateSchemaSql.php with no arguments fails for me because it tries to
read and write $IP/maintenance as if it were a file.
Use the loop body from the "all" case to reduce the amount of
duplicated logic. But it needs a special case so that
--sql=file.sql --type=sqlite writes to the specified file instead of
adding a subdirectory.
Change-Id: Ic88b5ea342d5e48e5465f1b0cbeff36b669a05a3
This adds an option to the schema generating maintenance scripts to
validate abstract schemas and schema changes and a structure test to
validate exisiting schemas and schema changes. Schemas are also
validated when generating.
The validation for the schema doesn't impose limits on table, index or
column names as I couldn't find any reliable conventions for them.
The structure tests only cover MediaWiki itself as there is no
convention on where extensions store their abstract schema.
Ideally, auto detection would be possible for sql/, but for now
extensions have to define their own (thankfully trivial) tests.
A couple of invalid definitions were fixed thanks to these tests.
I aimed to be thorough, but not all parts of the abstract schema
are completely clear, and Doctrine's documentation is not complete.
As a result, not everything has a description field.
Bug: T298320
Change-Id: I681d265317d4d1584869142ebb23d4098c06885f
This rewrites both generateSchemaChangeSql.php and generateSchemaSql.php
to deduplicate logic and adds the 'all' option to --type to generate
schemas for each supported DBMS platform.
Specifying a path with --sql will have the script insert a directory
named after the platform, but only when --type=all is provided.
Only if a directory named mysql/ exists will sql files for mysql be
placed there, to allow using a setup similar to MediaWiki, where only
non-mysql types have their sql files placed in dedicated directories.
This also adds preparations for T298320, so that the abstract schema
can be validated and any errors can be handled before generating a
schema.
Bug: T268587
Change-Id: Ief8282017c8d38659b79262afb8fc691b5bda256