Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 3.1.x into 3.2.x #4820

Merged
merged 5 commits into from
Sep 28, 2021
Merged
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
2 changes: 1 addition & 1 deletion src/Platforms/SqlitePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ public function getAlterTableSQL(TableDiff $diff)
private function replaceColumn($tableName, array $columns, $columnName, Column $column): array
{
$keys = array_keys($columns);
$index = array_search($columnName, $keys, true);
$index = array_search(strtolower($columnName), $keys, true);

if ($index === false) {
throw SchemaException::columnDoesNotExist($columnName, $tableName);
Expand Down
9 changes: 9 additions & 0 deletions src/Schema/SqliteSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -577,4 +577,13 @@ public function createComparator(): Comparator
{
return new SQLite\Comparator($this->getDatabasePlatform());
}

/**
* {@inheritDoc}
*/
public function getSchemaSearchPaths()
{
// SQLite does not support schemas or databases
return [];
}
}
22 changes: 19 additions & 3 deletions tests/Functional/Platform/RenameColumnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,23 @@

class RenameColumnTest extends FunctionalTestCase
{
public function testColumnPositionRetainedAfterRenaming(): void
/**
* @dataProvider columnNameProvider
*/
public function testColumnPositionRetainedAfterRenaming(string $columnName): void
{
if ($columnName === 'C1') {
self::markTestIncomplete('See https://github.com/doctrine/dbal/issues/4816');
}

$table = new Table('test_rename');
$table->addColumn('c1', 'string');
$table->addColumn($columnName, 'string');
$table->addColumn('c2', 'integer');

$sm = $this->connection->createSchemaManager();
$sm->dropAndCreateTable($table);

$table->dropColumn('c1')
$table->dropColumn($columnName)
->addColumn('c1_x', 'string');

$comparator = new Comparator();
Expand All @@ -31,4 +38,13 @@ public function testColumnPositionRetainedAfterRenaming(): void
$table = $sm->listTableDetails('test_rename');
self::assertSame(['c1_x', 'c2'], array_keys($table->getColumns()));
}

/**
* @return iterable<array{string}>
*/
public static function columnNameProvider(): iterable
{
yield ['c1'];
yield ['C1'];
}
}
17 changes: 17 additions & 0 deletions tests/Functional/Schema/SchemaTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

namespace Doctrine\DBAL\Tests\Functional\Schema;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Tests\FunctionalTestCase;

class SchemaTest extends FunctionalTestCase
{
public function testSchemaName(): void
{
$schema = new Schema([], [], $this->connection->createSchemaManager()->createSchemaConfig());
self::assertNotEmpty($schema->getName());
}
}