Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 15 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| DatabaseHooks | |
0.00% |
0 / 15 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
| onLoadExtensionSchemaUpdates | |
0.00% |
0 / 15 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Wikispeech\Hooks; |
| 4 | |
| 5 | /** |
| 6 | * @file |
| 7 | * @ingroup Extensions |
| 8 | * @license GPL-2.0-or-later |
| 9 | */ |
| 10 | |
| 11 | use DatabaseUpdater; |
| 12 | use MediaWiki\Installer\Hook\LoadExtensionSchemaUpdatesHook; |
| 13 | |
| 14 | /** |
| 15 | * @since 0.1.8 |
| 16 | */ |
| 17 | class DatabaseHooks |
| 18 | implements LoadExtensionSchemaUpdatesHook { |
| 19 | /** |
| 20 | * Creates database tables. |
| 21 | * |
| 22 | * @param DatabaseUpdater $updater |
| 23 | * @since 0.1.13 |
| 24 | */ |
| 25 | public function onLoadExtensionSchemaUpdates( $updater ) { |
| 26 | $type = $updater->getDB()->getType(); |
| 27 | $path = dirname( __DIR__ ) . '/../sql'; |
| 28 | |
| 29 | $updater->addExtensionTable( |
| 30 | 'wikispeech_utterance', |
| 31 | "$path/$type/tables-generated.sql" |
| 32 | ); |
| 33 | |
| 34 | if ( $type === 'postgres' ) { |
| 35 | $updater->modifyExtensionField( |
| 36 | 'wikispeech_utterance', 'wsu_date_stored', "$path/$type/patch-wikispeech_utterance-wsu_date_stored.sql" |
| 37 | ); |
| 38 | } |
| 39 | |
| 40 | $updater->addExtensionField( |
| 41 | 'wikispeech_utterance', |
| 42 | 'wsu_message_key', |
| 43 | "$path/$type/patch-wikispeech_utterance-wsu_message_key.sql" |
| 44 | ); |
| 45 | } |
| 46 | } |