Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/private/db/mdb2schemamanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ public function createDbFromStructure( $file ) {
*/
public function updateDbFromStructure($file, $generateSql = false) {
$sm = $this->conn->getSchemaManager();
$platform = $this->conn->getDatabasePlatform();
if ($platform instanceof \Doctrine\DBAL\Platforms\MySqlPlatform) {
$platform->registerDoctrineTypeMapping('enum', 'string');
}
$fromSchema = $sm->createSchema();

$schemaReader = new MDB2SchemaReader(\OC_Config::getObject(), $this->conn->getDatabasePlatform());
Expand Down
9 changes: 9 additions & 0 deletions tests/lib/dbschema.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ public function doTestSchemaRemoving() {
$this->assertTableNotExist($this->table2);
}

public function testMySqlEnum() {
if (OC_Config::getValue( 'dbtype', 'sqlite' ) !== 'mysql') {
$this->markTestSkipped('ENUM type can only be found on MySql');
}
$sql = "CREATE TABLE `oc_test` ( `e` enum('a','b') NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8";
\OC_DB::executeAudited($sql);
$this->testSchema();
}

/**
* @param string $table
*/
Expand Down