Merge branch 'm34_MDL-59583_Fix_MariaDB_10d2d7_Breaking_Change' of https://github...
authorAndrew Nicols <andrew@nicols.co.uk>
Thu, 3 Aug 2017 04:29:56 +0000 (12:29 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Thu, 3 Aug 2017 04:29:56 +0000 (12:29 +0800)
1  2 
lib/dml/mysqli_native_moodle_database.php

@@@ -804,10 -804,13 +804,13 @@@ class mysqli_native_moodle_database ext
          $info->meta_type      = $this->mysqltype2moodletype($rawcolumn->data_type);
          if ($this->has_breaking_change_quoted_defaults()) {
              $info->default_value = trim($rawcolumn->column_default, "'");
+             if ($info->default_value === 'NULL') {
+                 $info->default_value = null;
+             }
          } else {
              $info->default_value = $rawcolumn->column_default;
          }
-         $info->has_default    = !is_null($rawcolumn->column_default);
+         $info->has_default    = !is_null($info->default_value);
          $info->not_null       = ($rawcolumn->is_nullable === 'NO');
          $info->primary_key    = ($rawcolumn->column_key === 'PRI');
          $info->binary         = false;
  
          return true;
      }
 +
 +    /**
 +     * Converts a table to either 'Compressed' or 'Dynamic' row format.
 +     *
 +     * @param string $tablename Name of the table to convert to the new row format.
 +     */
 +    public function convert_table_row_format($tablename) {
 +        $currentrowformat = $this->get_row_format($tablename);
 +        if ($currentrowformat == 'Compact' || $currentrowformat == 'Redundant') {
 +            $rowformat = ($this->is_compressed_row_format_supported(false)) ? "ROW_FORMAT=Compressed" : "ROW_FORMAT=Dynamic";
 +            $prefix = $this->get_prefix();
 +            $this->change_database_structure("ALTER TABLE {$prefix}$tablename $rowformat");
 +        }
 +    }
  }