diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-11-26 11:10:41 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2021-03-17 21:08:22 +0100 |
commit | a2f3077ee802b4b291ba4f846bfceb69ec0f225f (patch) | |
tree | 81cbbd7deaf05dc9ba49f6f0a2c98ca0655e1e5e /tests/lib/DB | |
parent | 0d46fafd41a739c74a500d6149af23deb9d70155 (diff) | |
download | nextcloud-server-a2f3077ee802b4b291ba4f846bfceb69ec0f225f.tar.gz nextcloud-server-a2f3077ee802b4b291ba4f846bfceb69ec0f225f.zip |
Skip db migration simulation for core schema changes
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'tests/lib/DB')
-rw-r--r-- | tests/lib/DB/MigratorTest.php | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/tests/lib/DB/MigratorTest.php b/tests/lib/DB/MigratorTest.php index 6b758534897..12ff3bd0749 100644 --- a/tests/lib/DB/MigratorTest.php +++ b/tests/lib/DB/MigratorTest.php @@ -15,7 +15,6 @@ use Doctrine\DBAL\Platforms\OraclePlatform; use Doctrine\DBAL\Platforms\SqlitePlatform; use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\SchemaConfig; -use OC\DB\SchemaWrapper; use OCP\IConfig; /** @@ -131,58 +130,6 @@ class MigratorTest extends \Test\TestCase { return $this->connection->getDatabasePlatform() instanceof MySQLPlatform; } - - public function testDuplicateKeyUpgrade() { - $this->expectException(Exception\UniqueConstraintViolationException::class); - - if ($this->isSQLite()) { - $this->markTestSkipped('sqlite does not throw errors when creating a new key on existing data'); - } - [$startSchema, $endSchema] = $this->getDuplicateKeySchemas(); - $migrator = $this->manager->getMigrator(); - $migrator->migrate($startSchema); - - $this->connection->insert($this->tableName, ['id' => 1, 'name' => 'foo']); - $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'bar']); - $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'qwerty']); - - try { - $migrator->migrate($endSchema); - } catch (Exception\UniqueConstraintViolationException $e) { - if (!$this->isMySQL()) { - $this->connection->rollBack(); - } - throw $e; - } - } - - public function testChangeToString() { - [$startSchema, $endSchema] = $this->getChangedTypeSchema('integer', 'string'); - $migrator = $this->manager->getMigrator(); - $migrator->migrate($startSchema); - $schema = new SchemaWrapper($this->connection); - $table = $schema->getTable(substr($this->tableName, 3)); - $this->assertEquals('integer', $table->getColumn('id')->getType()->getName()); - - $this->connection->insert($this->tableName, ['id' => 1, 'name' => 'foo']); - $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'bar']); - $this->connection->insert($this->tableName, ['id' => 3, 'name' => 'qwerty']); - - $migrator->migrate($endSchema); - $this->addToAssertionCount(1); - - $qb = $this->connection->getQueryBuilder(); - $result = $qb->select('*')->from(substr($this->tableName, 3))->execute(); - $this->assertEquals([ - ['id' => 1, 'name' => 'foo'], - ['id' => 2, 'name' => 'bar'], - ['id' => 3, 'name' => 'qwerty'] - ], $result->fetchAll()); - $schema = new SchemaWrapper($this->connection); - $table = $schema->getTable(substr($this->tableName, 3)); - $this->assertEquals('string', $table->getColumn('id')->getType()->getName()); - } - public function testUpgrade() { [$startSchema, $endSchema] = $this->getDuplicateKeySchemas(); $migrator = $this->manager->getMigrator(); |