summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-01-31 14:43:40 +0100
committerGitHub <noreply@github.com>2018-01-31 14:43:40 +0100
commitc95f6a1dc99f7384a7f3cced0f749959edbc8164 (patch)
tree0000e573b96f1d9b69ef7ba889f23f15b60e02c1 /lib
parent142914608307839dca300a2d410b869b6d2d3444 (diff)
parent352a48e2732270317946919a27771a3088840aa0 (diff)
downloadnextcloud-server-c95f6a1dc99f7384a7f3cced0f749959edbc8164.tar.gz
nextcloud-server-c95f6a1dc99f7384a7f3cced0f749959edbc8164.zip
Merge pull request #8121 from nextcloud/bugfix/8085/migrations-table-has-old-collation
Create the migrations table also with the UTF8mb4 collation
Diffstat (limited to 'lib')
-rw-r--r--lib/private/DB/MigrationService.php22
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php
index 89a8d42f08a..29f717b886c 100644
--- a/lib/private/DB/MigrationService.php
+++ b/lib/private/DB/MigrationService.php
@@ -130,22 +130,20 @@ class MigrationService {
// Drop the table, when it didn't match our expectations.
$this->connection->dropTable('migrations');
+
+ // Recreate the schema after the table was dropped.
+ $schema = new SchemaWrapper($this->connection);
+
} catch (SchemaException $e) {
// Table not found, no need to panic, we will create it.
}
- $tableName = $this->connection->getPrefix() . 'migrations';
- $tableName = $this->connection->getDatabasePlatform()->quoteIdentifier($tableName);
-
- $columns = [
- 'app' => new Column($this->connection->getDatabasePlatform()->quoteIdentifier('app'), Type::getType('string'), ['length' => 255]),
- 'version' => new Column($this->connection->getDatabasePlatform()->quoteIdentifier('version'), Type::getType('string'), ['length' => 255]),
- ];
- $table = new Table($tableName, $columns);
- $table->setPrimaryKey([
- $this->connection->getDatabasePlatform()->quoteIdentifier('app'),
- $this->connection->getDatabasePlatform()->quoteIdentifier('version')]);
- $this->connection->getSchemaManager()->createTable($table);
+ $table = $schema->createTable('migrations');
+ $table->addColumn('app', Type::STRING, ['length' => 255]);
+ $table->addColumn('version', Type::STRING, ['length' => 255]);
+ $table->setPrimaryKey(['app', 'version']);
+
+ $this->connection->migrateToSchema($schema->getWrappedSchema());
$this->migrationTableCreated = true;