Skip to content

Commit

Permalink
Add MySQL 8 which defaults to mb4 mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Petry committed Nov 13, 2018
1 parent dddedc9 commit 2592821
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
22 changes: 17 additions & 5 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ services:
DB_TYPE: mariadb

mysql:
image: mysql:5.5
image: ${MYSQL_IMAGE=mysql:5.5}
environment:
- MYSQL_USER=owncloud
- MYSQL_PASSWORD=owncloud
Expand All @@ -444,16 +444,18 @@ services:
matrix:
DB_TYPE: mysql

mysqlmb4:
image: mysql:5.7
mysql8:
image: ${MYSQL_IMAGE=mysql:8.0}
# see http://php.net/manual/en/mysqli.requirements.php
command: --default-authentication-plugin=mysql_native_password
environment:
- MYSQL_USER=owncloud
- MYSQL_PASSWORD=owncloud
- MYSQL_DATABASE=owncloud
- MYSQL_ROOT_PASSWORD=owncloud
when:
matrix:
DB_TYPE: mysqlmb4
DB_TYPE: mysql8

postgres:
image: ${POSTGRES_IMAGE=postgres:9.4}
Expand Down Expand Up @@ -602,8 +604,17 @@ matrix:
INSTALL_SERVER: true

- PHP_VERSION: 7.1
DB_TYPE: mysqlmb4
DB_TYPE: mysql
# mb4 support, with innodb_file_format=Barracuda
MYSQL_IMAGE: mysql:5.7
TEST_SUITE: phpunit
INSTALL_SERVER: true

- PHP_VERSION: 7.1
# mb4 support by default
DB_TYPE: mysql8
TEST_SUITE: phpunit
COVERAGE: false
INSTALL_SERVER: true

# - PHP_VERSION: 7.1
Expand All @@ -627,6 +638,7 @@ matrix:

- PHP_VERSION: 7.1
DB_TYPE: mariadb
# mb4 support by default
MARIADB_IMAGE: mariadb:10.3
TEST_SUITE: phpunit
COVERAGE: true
Expand Down
6 changes: 6 additions & 0 deletions lib/private/DB/MySqlTools.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

use OCP\IDBConnection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Platforms\MySQL80Platform;

/**
* Various MySQL specific helper functions.
Expand Down Expand Up @@ -71,6 +72,11 @@ public function supports4ByteCharset(IDBConnection $connection) {
return true;
}

if ($connection->getDatabasePlatform() instanceof MySQL80Platform) {
// mb4 supported by default since MySQL 8.0 and innodb_file_format vars were removed
return true;
}

$version = $connection->getDatabaseVersionString();
$mariadb = \stripos($version, 'mariadb') !== false;
if ($mariadb && \version_compare($this->getMariaDbMysqlVersionNumber($version), '10.3.1', '>=')) {
Expand Down
4 changes: 4 additions & 0 deletions tests/drone/install-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ case "${DB_TYPE}" in
wait-for-it mysqlmb4:3306
DB=mysql
;;
mysql8)
wait-for-it mysql8:3306
DB=mysql
;;
postgres)
wait-for-it postgres:5432
DB=pgsql
Expand Down

0 comments on commit 2592821

Please sign in to comment.