MediaWiki REL1_32
PreMcrSchemaOverride.php
Go to the documentation of this file.
1<?php
3
5use MediaWiki\DB\PatchFileLocation;
6
10trait PreMcrSchemaOverride {
11
12 use PatchFileLocation;
13 use McrSchemaDetection;
14
18 protected function getMcrMigrationStage() {
19 return MIGRATION_OLD;
20 }
21
25 protected function getMcrTablesToReset() {
26 return [];
27 }
28
32 protected function getSchemaOverrides( IMaintainableDatabase $db ) {
33 $overrides = [
34 'scripts' => [],
35 'drop' => [],
36 'create' => [],
37 'alter' => [],
38 ];
39
40 if ( $this->hasMcrTables( $db ) ) {
41 $overrides['drop'] = [ 'slots', 'content', 'slot_roles', 'content_models', ];
42 $overrides['scripts'][] = $this->getSqlPatchPath( $db, '/drop-mcr-tables', __DIR__ );
43 }
44
45 if ( !$this->hasPreMcrFields( $db ) ) {
46 $overrides['alter'][] = 'revision';
47 $overrides['scripts'][] = $this->getSqlPatchPath( $db, '/create-pre-mcr-fields', __DIR__ );
48 }
49
50 return $overrides;
51 }
52
53}
const MIGRATION_OLD
Definition Defines.php:315
Advanced database interface for IDatabase handles that include maintenance methods.
getSchemaOverrides(IMaintainableDatabase $db)