2 namespace MediaWiki\Tests\Storage
;
4 use Wikimedia\Rdbms\IMaintainableDatabase
;
5 use MediaWiki\DB\PatchFileLocation
;
8 * Trait providing schema overrides that allow tests to run against the post-migration
11 trait McrSchemaOverride
{
13 use PatchFileLocation
;
14 use McrSchemaDetection
;
19 protected function getMcrMigrationStage() {
26 protected function getMcrTablesToReset() {
35 protected function getSchemaOverrides( IMaintainableDatabase
$db ) {
43 if ( !$this->hasMcrTables( $db ) ) {
44 $overrides['create'] = [ 'slots', 'content', 'slot_roles', 'content_models', ];
45 $overrides['scripts'][] = $this->getSqlPatchPath( $db, 'patch-slot_roles' );
46 $overrides['scripts'][] = $this->getSqlPatchPath( $db, 'patch-content_models' );
47 $overrides['scripts'][] = $this->getSqlPatchPath( $db, 'patch-content' );
48 $overrides['scripts'][] = $this->getSqlPatchPath( $db, 'patch-slots.sql' );
51 if ( !$this->hasPreMcrFields( $db ) ) {
52 $overrides['alter'][] = 'revision';
53 $overrides['scripts'][] = $this->getSqlPatchPath( $db, 'drop-pre-mcr-fields', __DIR__
);