mDescription = 'Migrates database schema to version 2.'; } public function execute() { $dbw = wfGetDB( DB_MASTER ); if ( !$dbw->tableExists( 'revtag' ) ) { $this->error( "Table revtag doesn't exist. Translate extension is not installed?", 1 ); } if ( !$dbw->tableExists( 'revtag_type' ) ) { $this->error( "Table revtag_type doesn't exist. Migration is already done.", 1 ); } if ( $dbw->getType() !== 'mysql' ) { $this->error( 'This migration script only supports mysql. Please help ' . "us to write routine for {$dbw->getType()}.", 1 ); } $table = $dbw->tableName( 'revtag' ); $dbw->query( "ALTER TABLE $table MODIFY rt_type varbinary(60) not null", __METHOD__ ); $res = $dbw->select( 'revtag_type', [ 'rtt_id', 'rtt_name' ], [], __METHOD__ ); foreach ( $res as $row ) { $dbw->update( 'revtag', [ 'rt_type' => $row->rtt_name ], [ 'rt_type' => (string)$row->rtt_id ], __METHOD__ ); } $dbw->dropTable( 'revtag_type', __METHOD__ ); } } $maintClass = TSchema2::class; require_once RUN_MAINTENANCE_IF_MAIN;