|
25 | 25 | use Doctrine\DBAL\Schema\View;
|
26 | 26 | use Doctrine\DBAL\Tests\FunctionalTestCase;
|
27 | 27 | use Doctrine\DBAL\Types\ArrayType;
|
| 28 | +use Doctrine\DBAL\Types\BigIntType; |
28 | 29 | use Doctrine\DBAL\Types\BinaryType;
|
29 | 30 | use Doctrine\DBAL\Types\BlobType;
|
30 | 31 | use Doctrine\DBAL\Types\DateIntervalType;
|
@@ -298,7 +299,12 @@ public function testListTableColumns(): void
|
298 | 299 | self::assertArrayHasKey('id', $columns);
|
299 | 300 | self::assertEquals(0, array_search('id', $columnsKeys, true));
|
300 | 301 | self::assertEquals('id', strtolower($columns['id']->getName()));
|
301 |
| - self::assertInstanceOf(IntegerType::class, $columns['id']->getType()); |
| 302 | + self::assertInstanceOf( |
| 303 | + $this->connection->getDatabasePlatform() instanceof SqlitePlatform |
| 304 | + ? BigIntType::class |
| 305 | + : IntegerType::class, |
| 306 | + $columns['id']->getType(), |
| 307 | + ); |
302 | 308 | self::assertEquals(false, $columns['id']->getUnsigned());
|
303 | 309 | self::assertEquals(true, $columns['id']->getNotnull());
|
304 | 310 | self::assertEquals(null, $columns['id']->getDefault());
|
@@ -363,6 +369,29 @@ public function testListTableColumns(): void
|
363 | 369 | self::assertIsArray($columns['baz3']->getPlatformOptions());
|
364 | 370 | }
|
365 | 371 |
|
| 372 | + public function testListTableColumnsWithBigintColumns(): void |
| 373 | + { |
| 374 | + $tableName = 'test_list_table_bigint'; |
| 375 | + |
| 376 | + $table = new Table($tableName); |
| 377 | + $table->addColumn('id_with_ai', Types::BIGINT); |
| 378 | + $table->setPrimaryKey(['id_with_ai']); |
| 379 | + $table->addColumn('foo', Types::BIGINT); |
| 380 | + $table->addColumn('bar', Types::INTEGER); |
| 381 | + |
| 382 | + $this->schemaManager->createTable($table); |
| 383 | + |
| 384 | + $columns = $this->schemaManager->listTableColumns($tableName); |
| 385 | + |
| 386 | + self::assertCount(3, $columns); |
| 387 | + self::assertArrayHasKey('id_with_ai', $columns); |
| 388 | + self::assertInstanceOf(BigIntType::class, $columns['id_with_ai']->getType()); |
| 389 | + self::assertArrayHasKey('foo', $columns); |
| 390 | + self::assertInstanceOf(BigIntType::class, $columns['foo']->getType()); |
| 391 | + self::assertArrayHasKey('bar', $columns); |
| 392 | + self::assertInstanceOf(IntegerType::class, $columns['bar']->getType()); |
| 393 | + } |
| 394 | + |
366 | 395 | public function testListTableColumnsWithFixedStringColumn(): void
|
367 | 396 | {
|
368 | 397 | $tableName = 'test_list_table_fixed_string';
|
@@ -457,6 +486,11 @@ public function testDiffListTableColumns(callable $comparatorFactory): void
|
457 | 486 | }
|
458 | 487 |
|
459 | 488 | $offlineTable = $this->createListTableColumns();
|
| 489 | + |
| 490 | + if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) { |
| 491 | + $offlineTable->getColumn('id')->setType(Type::getType(Types::BIGINT)); |
| 492 | + } |
| 493 | + |
460 | 494 | $this->dropAndCreateTable($offlineTable);
|
461 | 495 | $onlineTable = $this->schemaManager->introspectTable('list_table_columns');
|
462 | 496 |
|
|
0 commit comments