Skip to content

Commit 0da706e

Browse files
committed
update column lengths
1 parent 52e0d4f commit 0da706e

File tree

5 files changed

+20
-25
lines changed

5 files changed

+20
-25
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: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -83,25 +83,18 @@ 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
87-
try {
88-
$schemaTool->createSchema($metadata);
89-
} catch (ToolsException $e) {
90-
// If creating all tables at once fails, try to create them one by one
91-
// This is a fallback mechanism
92-
$connection = $this->entityManager->getConnection();
93-
$schemaManager = $connection->createSchemaManager();
86+
$connection = $this->entityManager->getConnection();
87+
$schemaManager = $connection->createSchemaManager();
9488

95-
foreach ($metadata as $classMetadata) {
96-
$tableName = $classMetadata->getTableName();
89+
foreach ($metadata as $classMetadata) {
90+
$tableName = $classMetadata->getTableName();
9791

98-
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-
}
92+
if (!$schemaManager->tablesExist([$tableName])) {
93+
try {
94+
$schemaTool->createSchema([$classMetadata]);
95+
} catch (ToolsException $e) {
96+
// nothing to do
97+
echo $e->getMessage();
10598
}
10699
}
107100
}

0 commit comments

Comments
 (0)