Increased long URL size in DB to 2048 characters

This commit is contained in:
Alejandro Celaya
2019-10-20 09:53:11 +02:00
parent 30e4ddb950
commit b8cdc29d8f
4 changed files with 40 additions and 1 deletions

View File

@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace ShlinkMigrations;
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\Migrations\AbstractMigration;
final class Version20191020074522 extends AbstractMigration
{
/**
* @throws SchemaException
*/
public function up(Schema $schema): void
{
$this->getOriginalUrlColumn($schema)->setLength(2048);
}
/**
* @throws SchemaException
*/
public function down(Schema $schema): void
{
$this->getOriginalUrlColumn($schema)->setLength(1024);
}
/**
* @throws SchemaException
*/
private function getOriginalUrlColumn(Schema $schema): Column
{
return $schema->getTable('short_urls')->getColumn('original_url');
}
}