updateRowExists( $updateKey ) ) { return; } $info = $this->db->fieldInfo( $table, $field ); if ( $info && $info->defaultValue() !== false ) { $this->output( "Removing '$table.$field' default value.\n" ); $table = $this->db->tableName( $table ); $ret = $this->db->query( "ALTER TABLE $table ALTER COLUMN $field DROP DEFAULT", __METHOD__ ); if ( $ret ) { $this->insertUpdateRow( $updateKey ); } } } /** * Set a default value for a field * * @since 1.36 * @param string $table * @param string $field * @param mixed $default */ protected function setDefault( $table, $field, $default ) { $info = $this->db->fieldInfo( $table, $field ); if ( $info && $info->defaultValue() !== $default ) { $this->output( "Changing '$table.$field' default value.\n" ); $table = $this->db->tableName( $table ); $this->db->query( "ALTER TABLE $table ALTER COLUMN $field SET DEFAULT " . $this->db->addQuotes( $default ), __METHOD__ ); } } /** * Change the table options of a table * * @since 1.43 * @param string $table * @param string $tableOption Raw table option that should already have been escaped !!!! * @param string $updateName */ protected function changeTableOption( string $table, string $tableOption, string $updateName ) { $updateKey = "$table-tableoption-$updateName"; if ( $this->updateRowExists( $updateKey ) ) { return; } $this->output( "Changing table options of '$table'.\n" ); $table = $this->db->tableName( $table ); $ret = $this->db->query( "ALTER TABLE $table $tableOption", __METHOD__ ); if ( $ret ) { $this->insertUpdateRow( $updateKey ); } } protected function migrateSearchindex() { $updateKey = 'searchindex-pk-titlelength'; if ( !$this->tableExists( 'searchindex' ) ) { return; } $primaryIndexExists = $this->db->indexExists( 'searchindex', 'PRIMARY' ); if ( $this->updateRowExists( $updateKey ) || $primaryIndexExists ) { $this->output( "...searchindex table has already been migrated.\n" ); if ( !$this->updateRowExists( $updateKey ) ) { $this->insertUpdateRow( $updateKey ); } return; } $apply = $this->applyPatch( 'patch-searchindex-pk-titlelength.sql', false, '...migrating searchindex table' ); if ( $apply ) { $this->insertUpdateRow( $updateKey ); } } } /** @deprecated class alias since 1.42 */ class_alias( MysqlUpdater::class, 'MysqlUpdater' );