Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 16 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
SchemaHooks | |
0.00% |
0 / 16 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
onLoadExtensionSchemaUpdates | |
0.00% |
0 / 16 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | namespace GrowthExperiments; |
4 | |
5 | use MediaWiki\Installer\Hook\LoadExtensionSchemaUpdatesHook; |
6 | |
7 | /** |
8 | * LoadExtensionSchemaUpdates hook handler. |
9 | * This hook handler must not have any service dependencies. |
10 | */ |
11 | class SchemaHooks implements LoadExtensionSchemaUpdatesHook { |
12 | |
13 | public const VIRTUAL_DOMAIN = 'virtual-growthexperiments'; |
14 | private const TABLES = [ |
15 | 'growthexperiments_link_recommendations', 'growthexperiments_link_submissions', |
16 | 'growthexperiments_mentee_data', 'growthexperiments_mentor_mentee', |
17 | 'growthexperiments_user_impact', |
18 | ]; |
19 | |
20 | /** @inheritDoc */ |
21 | public function onLoadExtensionSchemaUpdates( $updater ) { |
22 | $sqlDir = __DIR__ . '/../sql/' . $updater->getDB()->getType(); |
23 | |
24 | foreach ( self::TABLES as $tableName ) { |
25 | $updater->addExtensionUpdateOnVirtualDomain( [ |
26 | self::VIRTUAL_DOMAIN, 'addTable', |
27 | $tableName, "$sqlDir/$tableName.sql", true, |
28 | ] ); |
29 | } |
30 | |
31 | $updater->addExtensionUpdateOnVirtualDomain( [ |
32 | self::VIRTUAL_DOMAIN, 'addField', |
33 | 'growthexperiments_link_submissions', 'gels_anchor_offset', |
34 | "$sqlDir/patch-add_gemm_mentee_is_active.sql", true, |
35 | ] ); |
36 | $updater->addExtensionUpdateOnVirtualDomain( [ |
37 | self::VIRTUAL_DOMAIN, 'addField', |
38 | 'growthexperiments_mentor_mentee', 'gemm_mentee_is_active', |
39 | "$sqlDir/patch-add_gemm_mentee_is_active.sql", true, |
40 | ] ); |
41 | } |
42 | |
43 | } |