Merge pull request #255 from acelaya/feature/user-agent-length

Updated user agent column in visits table to have a length of 512
This commit is contained in:
Alejandro Celaya 2018-11-10 19:07:22 +01:00 committed by GitHub
commit 098f7afc70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 4 deletions

View file

@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
* [#225](https://github.com/shlinkio/shlink/issues/225) Performance and maintainability slightly improved by enforcing via code sniffer that all global namespace classes, functions and constants are explicitly imported.
* [#196](https://github.com/shlinkio/shlink/issues/196) Reduced anemic model in entities, defining more expressive public APIs instead.
* [#249](https://github.com/shlinkio/shlink/issues/249) Added [functional-php](https://github.com/lstrojny/functional-php) to ease collections handling.
* [#253](https://github.com/shlinkio/shlink/issues/253) Increased `user_agent` column length in `visits` table to 512.
#### Deprecated

View file

@ -0,0 +1,36 @@
<?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 Version20181110175521 extends AbstractMigration
{
/**
* @throws SchemaException
*/
public function up(Schema $schema): void
{
$this->getUserAgentColumn($schema)->setLength(512);
}
/**
* @throws SchemaException
*/
public function down(Schema $schema): void
{
$this->getUserAgentColumn($schema)->setLength(256);
}
/**
* @throws SchemaException
*/
private function getUserAgentColumn(Schema $schema): Column
{
return $schema->getTable('visits')->getColumn('user_agent');
}
}

View file

@ -6,9 +6,6 @@ namespace <namespace>;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version<version> extends AbstractMigration
{
public function up(Schema $schema): void

View file

@ -39,7 +39,7 @@ class Visit extends AbstractEntity implements JsonSerializable
private $remoteAddr;
/**
* @var string
* @ORM\Column(type="string", length=256, name="user_agent", nullable=true)
* @ORM\Column(type="string", length=512, name="user_agent", nullable=true)
*/
private $userAgent;
/**