Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| GenerateSchemaSql | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| generateSchema | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Convert a JSON abstract schema to a schema file in the given DBMS type |
| 5 | * |
| 6 | * @license GPL-2.0-or-later |
| 7 | * @file |
| 8 | * @ingroup Maintenance |
| 9 | */ |
| 10 | |
| 11 | use MediaWiki\Maintenance\SchemaGenerator; |
| 12 | use MediaWiki\Maintenance\SchemaMaintenance; |
| 13 | |
| 14 | // @codeCoverageIgnoreStart |
| 15 | require_once __DIR__ . '/includes/SchemaMaintenance.php'; |
| 16 | // @codeCoverageIgnoreEnd |
| 17 | |
| 18 | /** |
| 19 | * Maintenance script to generate schema from abstract json files. |
| 20 | * |
| 21 | * @ingroup Maintenance |
| 22 | */ |
| 23 | class GenerateSchemaSql extends SchemaMaintenance { |
| 24 | public function __construct() { |
| 25 | parent::__construct(); |
| 26 | $this->addDescription( 'Build SQL files from abstract JSON files' ); |
| 27 | } |
| 28 | |
| 29 | protected function generateSchema( string $platform, string $jsonPath ): string { |
| 30 | return ( new SchemaGenerator() )->generateSchema( $platform, $jsonPath ); |
| 31 | } |
| 32 | |
| 33 | } |
| 34 | |
| 35 | // @codeCoverageIgnoreStart |
| 36 | $maintClass = GenerateSchemaSql::class; |
| 37 | require_once RUN_MAINTENANCE_IF_MAIN; |
| 38 | // @codeCoverageIgnoreEnd |