Skip to content

Commit 8fc793a

Browse files
committed
update column lengths
1 parent 52e0d4f commit 8fc793a

File tree

6 files changed

+12
-18
lines changed

6 files changed

+12
-18
lines changed

config/config_test.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,9 @@ doctrine:
1313
dbal:
1414
driver: 'pdo_mysql'
1515
host: '%database_host%'
16-
path: '%database_path%'
1716
port: '%database_port%'
1817
dbname: 'phplist'
1918
user: '%database_user%'
2019
password: '%database_password%'
2120
charset: UTF8
22-
# orm:
23-
# entity_managers:
24-
# default:
25-
# report_fields_where_declared: true
21+

src/Domain/Analytics/Model/LinkTrackForward.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ class LinkTrackForward implements DomainModel, Identity
2121
#[ORM\GeneratedValue]
2222
private ?int $id = null;
2323

24-
#[ORM\Column(type: 'string', length: 2083, nullable: true)]
24+
// Defined as string(255) due to MySQL limitation (actual max URL length is 2083):
25+
// TEXT can't be indexed without a prefix, which Doctrine doesn't support.
26+
#[ORM\Column(type: 'string', length: 255, nullable: true)]
2527
private ?string $url = null;
2628

2729
#[ORM\Column(name: 'urlhash', type: 'string', length: 32, nullable: true)]

src/Domain/Configuration/Model/I18n.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ class I18n implements DomainModel
1818
#[ORM\Column(type: 'string', length: 10)]
1919
private string $lan;
2020

21+
// Defined as string with length due to MySQL limitation:
22+
// TEXT columns can't be indexed without a prefix length, which Doctrine doesn't support.
2123
#[ORM\Id]
22-
#[ORM\Column(type: 'text')]
24+
#[ORM\Column(type: 'string', length: 255)]
2325
private string $original;
2426

2527
#[ORM\Column(type: 'text')]

src/Domain/Configuration/Model/UrlCache.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ class UrlCache implements DomainModel, Identity
2020
#[ORM\GeneratedValue]
2121
private ?int $id = null;
2222

23-
#[ORM\Column(name: 'url', type: 'string', length: 2083)]
23+
// Defined as string(255) due to MySQL limitation (actual max URL length is 2083):
24+
// TEXT can't be indexed without a prefix, which Doctrine doesn't support.
25+
#[ORM\Column(name: 'url', type: 'string', length: 255)]
2426
private string $url;
2527

2628
#[ORM\Column(name: 'lastmodified', type: 'integer', nullable: true)]

src/TestingSupport/Traits/DatabaseTestTrait.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,25 +83,17 @@ protected function loadSchema(): void
8383
$schemaTool = new SchemaTool($this->entityManager);
8484
$metadata = $this->entityManager->getMetadataFactory()->getAllMetadata();
8585

86-
// Create all tables at once to handle dependencies properly
8786
try {
8887
$schemaTool->createSchema($metadata);
8988
} catch (ToolsException $e) {
90-
// If creating all tables at once fails, try to create them one by one
91-
// This is a fallback mechanism
9289
$connection = $this->entityManager->getConnection();
9390
$schemaManager = $connection->createSchemaManager();
9491

9592
foreach ($metadata as $classMetadata) {
9693
$tableName = $classMetadata->getTableName();
9794

9895
if (!$schemaManager->tablesExist([$tableName])) {
99-
try {
100-
$schemaTool->createSchema([$classMetadata]);
101-
} catch (ToolsException $e) {
102-
// Log the error but continue with other tables
103-
echo $e->getMessage() . PHP_EOL;
104-
}
96+
$schemaTool->createSchema([$classMetadata]);
10597
}
10698
}
10799
}

tests/Integration/Domain/Identity/Repository/AdministratorRepositoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected function tearDown(): void
4343
public function testFindReadsModelFromDatabase(): void
4444
{
4545
/** @var Administrator $actual */
46-
$actual = $this->repository->find(1);
46+
$actual = $this->repository->findOneBy(['email' => '[email protected]']);
4747

4848
$this->assertNotNull($actual);
4949
$this->assertFalse($actual->isDisabled());

0 commit comments

Comments
 (0)