aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/DB/MDB2SchemaManager.php
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-07-30 10:57:16 +0200
committerMorris Jobke <hey@morrisjobke.de>2017-03-21 16:42:12 -0600
commit713f684a8b543050c6107e65dcf65a0e1566914c (patch)
treef47d453233417dc7cbe03b318d91ed0995afa64f /lib/private/DB/MDB2SchemaManager.php
parentd2b1b0224437e521094dd251bc84bc93d1e338b1 (diff)
downloadnextcloud-server-713f684a8b543050c6107e65dcf65a0e1566914c.tar.gz
nextcloud-server-713f684a8b543050c6107e65dcf65a0e1566914c.zip
Adding tests for 4 byte unicode characters
* success on SQLite and Postgres * failure on MySQL due to the limited charset that only supports up to 3 bytes Add config option to update charset of mysql to utf8mb4 * fully optional * requires additional options set in the database only disable unicode test on mysql Fixing ctor call Adding docker based unit test execution for mysql utf8mb4 Add mysqlmb4 test configuration to Jenkinsfile fix collation on utf8mb4 Properly setup charset and collation in the doctrine connection Allow files containing 4-byte chars in case the database supports it During setup of a mysql database we try to detect if charset 'utf8mb4' can be used Fix mysql settings Add console command to migrate the charset Set ROW_FORMAT before setting collation to mb4 Also select tables with wrong collation Faster MySQL docker Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib/private/DB/MDB2SchemaManager.php')
-rw-r--r--lib/private/DB/MDB2SchemaManager.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/private/DB/MDB2SchemaManager.php b/lib/private/DB/MDB2SchemaManager.php
index f209991eb84..89b0d153212 100644
--- a/lib/private/DB/MDB2SchemaManager.php
+++ b/lib/private/DB/MDB2SchemaManager.php
@@ -33,6 +33,7 @@ use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
+use Doctrine\DBAL\Schema\Schema;
use OCP\IDBConnection;
class MDB2SchemaManager {
@@ -66,7 +67,8 @@ class MDB2SchemaManager {
*/
public function createDbFromStructure($file) {
$schemaReader = new MDB2SchemaReader(\OC::$server->getConfig(), $this->conn->getDatabasePlatform());
- $toSchema = $schemaReader->loadSchemaFromFile($file);
+ $toSchema = new Schema([], [], $this->conn->getSchemaManager()->createSchemaConfig());
+ $toSchema = $schemaReader->loadSchemaFromFile($file, $toSchema);
return $this->executeSchemaChange($toSchema);
}
@@ -100,7 +102,8 @@ class MDB2SchemaManager {
private function readSchemaFromFile($file) {
$platform = $this->conn->getDatabasePlatform();
$schemaReader = new MDB2SchemaReader(\OC::$server->getConfig(), $platform);
- return $schemaReader->loadSchemaFromFile($file);
+ $toSchema = new Schema([], [], $this->conn->getSchemaManager()->createSchemaConfig());
+ return $schemaReader->loadSchemaFromFile($file, $toSchema);
}
/**
@@ -137,7 +140,8 @@ class MDB2SchemaManager {
*/
public function removeDBStructure($file) {
$schemaReader = new MDB2SchemaReader(\OC::$server->getConfig(), $this->conn->getDatabasePlatform());
- $fromSchema = $schemaReader->loadSchemaFromFile($file);
+ $toSchema = new Schema([], [], $this->conn->getSchemaManager()->createSchemaConfig());
+ $fromSchema = $schemaReader->loadSchemaFromFile($file, $toSchema);
$toSchema = clone $fromSchema;
/** @var $table \Doctrine\DBAL\Schema\Table */
foreach ($toSchema->getTables() as $table) {