Skip to content

Commit be0a83d

Browse files
committed
Fix MySql migrations
1 parent a9a25c1 commit be0a83d

File tree

9 files changed

+259
-257
lines changed

9 files changed

+259
-257
lines changed

src/Domain/Analytics/Model/LinkTrackForward.php

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

24-
// Defined as string(255) due to MySQL limitation (actual max URL length is 2083):
24+
// Index is set by updating SQL in the migration file
2525
// TEXT can't be indexed without a prefix, which Doctrine doesn't support.
26-
#[ORM\Column(type: 'string', length: 255, nullable: true)]
26+
#[ORM\Column(type: 'string', length: 2083, nullable: true)]
2727
private ?string $url = null;
2828

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

src/Domain/Configuration/Model/UrlCache.php

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

24-
// Defined as string(255) due to MySQL limitation (actual max URL length is 2083):
24+
// Index is set by updating SQL in the migration file
2525
// TEXT can't be indexed without a prefix, which Doctrine doesn't support.
26-
#[ORM\Column(name: 'url', type: 'string', length: 255)]
26+
#[ORM\Column(name: 'url', type: 'string', length: 2083)]
2727
private string $url;
2828

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

src/Domain/Identity/Model/AdministratorToken.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use DateTime;
88
use DateTimeZone;
99
use Doctrine\ORM\Mapping as ORM;
10-
use Doctrine\Persistence\Proxy;
1110
use PhpList\Core\Domain\Common\Model\Interfaces\CreationDate;
1211
use PhpList\Core\Domain\Common\Model\Interfaces\DomainModel;
1312
use PhpList\Core\Domain\Common\Model\Interfaces\Identity;

src/Migrations/.gitkeep

Whitespace-only changes.

src/Migrations/Version20251028092901MySql.php renamed to src/Migrations/Version20251028092901MySqlInit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* Manual Migration
1313
*/
14-
final class Version20251028092901MySql extends AbstractMigration
14+
final class Version20251028092901MySqlInit extends AbstractMigration
1515
{
1616
public function getDescription(): string
1717
{

src/Migrations/Version20251030083621MySqlRenameIndex.php renamed to src/Migrations/Version20251028092902MySqlUpdate.php

Lines changed: 138 additions & 32 deletions
Large diffs are not rendered by default.

src/Migrations/Version20251029105320MySqlRelations.php

Lines changed: 0 additions & 192 deletions
This file was deleted.

src/Migrations/Version20251030081120PostgreSqlPlatform.php renamed to src/Migrations/Version20251031072945PostGreInit.php

Lines changed: 108 additions & 26 deletions
Large diffs are not rendered by default.

src/Migrations/_template_migration.php.tpl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,18 @@ use Doctrine\DBAL\Platforms\MySQLPlatform;
99
use Doctrine\Migrations\AbstractMigration;
1010
use Doctrine\DBAL\Schema\Schema;
1111

12+
/**
13+
* ⚠️ Wizard warning:
14+
* Doctrine will `helpfully` remove url(255) prefixes and add collations 5.7 can’t read.
15+
* Review the SQL unless you enjoy debugging key length errors at 2 AM.
16+
*
17+
* Ex: phplist_linktrack_forward phplist_linktrack_forward_urlindex (but there are more)
18+
*/
1219
final class <className> extends AbstractMigration
1320
{
1421
public function getDescription(): string
1522
{
16-
return '<comment>';
23+
return '';
1724
}
1825

1926
public function up(Schema $schema): void

0 commit comments

Comments
 (0)