diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-01-31 17:29:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-31 17:29:00 +0100 |
commit | c39a40f15fd6291b42b9a93c8aa6d1de4de4ffec (patch) | |
tree | d943b114f5713eaae605521eb32969e6ae456e9c | |
parent | dabce9685b896904c428ced37abba20ecd55ccba (diff) | |
parent | 119de6467fd39938e79a7c96a16e25aba562172a (diff) | |
download | nextcloud-server-c39a40f15fd6291b42b9a93c8aa6d1de4de4ffec.tar.gz nextcloud-server-c39a40f15fd6291b42b9a93c8aa6d1de4de4ffec.zip |
Merge pull request #8126 from nextcloud/13-8121
[stable13] Create the migrations table also with the UTF8mb4 collation
-rw-r--r-- | lib/private/DB/MigrationService.php | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php index 5e2c7e69ee9..9afe231b326 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; |