Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 7
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 / 7
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 1
 onLoadExtensionSchemaUpdates
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2namespace MediaWiki\Extension\BounceHandler;
3
4use DatabaseUpdater;
5use MediaWiki\Installer\Hook\LoadExtensionSchemaUpdatesHook;
6
7/**
8 * Schema Hooks used by BounceHandler
9 *
10 * @file
11 * @ingroup Hooks
12 * @author Tony Thomas, Kunal Mehta, Jeff Green
13 * @license GPL-2.0-or-later
14 */
15class SchemaHooks implements LoadExtensionSchemaUpdatesHook {
16    /**
17     * Add tables to the database
18     *
19     * @param DatabaseUpdater $updater
20     */
21    public function onLoadExtensionSchemaUpdates( $updater ) {
22        $type = $updater->getDB()->getType();
23        $path = dirname( __DIR__ ) . '/sql';
24
25        $updater->addExtensionTable( 'bounce_records', "$path/$type/tables-generated.sql" );
26
27        if ( $type !== 'sqlite' ) {
28            // 1.38
29            $updater->modifyExtensionField(
30                'bounce_records', 'br_timestamp', "$path/$type/patch-bounce_records-br_timestamp.sql"
31            );
32        }
33    }
34}