Change long URL columns to TEXT type

This commit is contained in:
Alejandro Celaya 2024-02-20 22:57:33 +01:00
parent 145d4eaaed
commit 8f954151ca
4 changed files with 32 additions and 7 deletions

View file

@ -25,17 +25,17 @@ return static function (ClassMetadata $metadata, array $emConfig): void {
->unique()
->build();
fieldWithUtf8Charset($builder->createField('baseUrlRedirect', Types::STRING), $emConfig)
fieldWithUtf8Charset($builder->createField('baseUrlRedirect', Types::TEXT), $emConfig)
->columnName('base_url_redirect')
->nullable()
->build();
fieldWithUtf8Charset($builder->createField('regular404Redirect', Types::STRING), $emConfig)
fieldWithUtf8Charset($builder->createField('regular404Redirect', Types::TEXT), $emConfig)
->columnName('regular_not_found_redirect')
->nullable()
->build();
fieldWithUtf8Charset($builder->createField('invalidShortUrlRedirect', Types::STRING), $emConfig)
fieldWithUtf8Charset($builder->createField('invalidShortUrlRedirect', Types::TEXT), $emConfig)
->columnName('invalid_short_url_redirect')
->nullable()
->build();

View file

@ -30,9 +30,8 @@ return static function (ClassMetadata $metadata, array $emConfig): void {
->length(255)
->build();
fieldWithUtf8Charset($builder->createField('longUrl', Types::STRING), $emConfig)
fieldWithUtf8Charset($builder->createField('longUrl', Types::TEXT), $emConfig)
->columnName('long_url')
->length(2048)
->build();
$builder->createManyToOne('shortUrl', ShortUrl\Entity\ShortUrl::class)

View file

@ -23,9 +23,8 @@ return static function (ClassMetadata $metadata, array $emConfig): void {
->option('unsigned', true)
->build();
fieldWithUtf8Charset($builder->createField('longUrl', Types::STRING), $emConfig)
fieldWithUtf8Charset($builder->createField('longUrl', Types::TEXT), $emConfig)
->columnName('original_url') // Rename to long_url some day? ¯\_(ツ)_/¯
->length(2048)
->build();
fieldWithUtf8Charset($builder->createField('shortCode', Types::STRING), $emConfig, 'bin')

View file

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace ShlinkMigrations;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20240220214031 extends AbstractMigration
{
public function up(Schema $schema): void
{
}
public function down(Schema $schema): void
{
}
public function isTransactional(): bool
{
return ! ($this->connection->getDatabasePlatform() instanceof MySQLPlatform);
}
}