3 namespace MediaWiki\Tests\Revision
;
5 use Wikimedia\Rdbms\IMaintainableDatabase
;
6 use MediaWiki\DB\PatchFileLocation
;
9 * Trait providing schema overrides that allow tests to run against the post-migration
10 * MCR database schema.
12 trait McrSchemaOverride
{
14 use PatchFileLocation
;
15 use McrSchemaDetection
;
20 protected function getMcrMigrationStage() {
27 protected function getMcrTablesToReset() {
36 protected function getSchemaOverrides( IMaintainableDatabase
$db ) {
44 if ( !$this->hasMcrTables( $db ) ) {
45 $overrides['create'] = [ 'slots', 'content', 'slot_roles', 'content_models', ];
46 $overrides['scripts'][] = $this->getSqlPatchPath( $db, 'patch-slot_roles' );
47 $overrides['scripts'][] = $this->getSqlPatchPath( $db, 'patch-content_models' );
48 $overrides['scripts'][] = $this->getSqlPatchPath( $db, 'patch-content' );
49 $overrides['scripts'][] = $this->getSqlPatchPath( $db, 'patch-slots' );
52 if ( !$this->hasPreMcrFields( $db ) ) {
53 $overrides['alter'][] = 'revision';
54 $overrides['scripts'][] = $this->getSqlPatchPath( $db, 'drop-pre-mcr-fields', __DIR__
);