Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 29
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
SchemaHooks
0.00% covered (danger)
0.00%
0 / 29
0.00% covered (danger)
0.00%
0 / 1
20
0.00% covered (danger)
0.00%
0 / 1
 onLoadExtensionSchemaUpdates
0.00% covered (danger)
0.00%
0 / 29
0.00% covered (danger)
0.00%
0 / 1
20
1<?php
2
3namespace MediaWiki\Extension\WikiLove;
4
5use MediaWiki\Installer\DatabaseUpdater;
6use MediaWiki\Installer\Hook\LoadExtensionSchemaUpdatesHook;
7
8/**
9 * Schema hooks for WikiLove extension
10 *
11 * @file
12 * @ingroup Extensions
13 */
14
15class SchemaHooks implements LoadExtensionSchemaUpdatesHook {
16
17    /**
18     * LoadExtensionSchemaUpdates hook
19     *
20     * @param DatabaseUpdater $updater
21     */
22    public function onLoadExtensionSchemaUpdates( $updater ) {
23        $dbType = $updater->getDB()->getType();
24        $path = dirname( __DIR__ ) . '/patches';
25        if ( $dbType === 'mysql' ) {
26            $updater->addExtensionTable( 'wikilove_log',
27                $path . '/tables-generated.sql'
28            );
29            $updater->modifyExtensionField(
30                'wikilove_log',
31                'wll_timestamp',
32                $path . '/patch-wikilove_log-cleanup.sql'
33            );
34        } elseif ( $dbType === 'sqlite' ) {
35            $updater->addExtensionTable( 'wikilove_log',
36                $path . '/sqlite/tables-generated.sql'
37            );
38            $updater->modifyExtensionField(
39                'wikilove_log',
40                'wll_timestamp',
41                $path . '/sqlite/patch-wikilove_log-cleanup.sql'
42            );
43        } elseif ( $dbType === 'postgres' ) {
44            $updater->addExtensionTable( 'wikilove_log',
45                $path . '/postgres/tables-generated.sql'
46            );
47            $updater->modifyExtensionField(
48                'wikilove_log',
49                'wll_timestamp',
50                $path . '/postgres/patch-wikilove_log-cleanup.sql'
51            );
52        }
53    }
54
55}