Fix nullability on expanded Listener data.

This commit is contained in:
Buster "Silver Eagle" Neece 2022-04-21 07:41:56 -05:00
parent d2ffb34388
commit f1917386f3
No known key found for this signature in database
GPG Key ID: 9FC8B9E008872109
3 changed files with 30 additions and 4 deletions

View File

@ -21,10 +21,10 @@ class ListenerDevice implements \JsonSerializable
#[ORM\Column]
protected bool $is_bot = false;
#[ORM\Column(length: 150)]
#[ORM\Column(length: 150, nullable: true)]
protected ?string $browser_family = null;
#[ORM\Column(length: 150)]
#[ORM\Column(length: 150, nullable: true)]
protected ?string $os_family = null;
public function getClient(): ?string

View File

@ -9,8 +9,8 @@ use Doctrine\ORM\Mapping as ORM;
#[ORM\Embeddable]
class ListenerLocation implements \JsonSerializable
{
#[ORM\Column(length: 255)]
protected string $description;
#[ORM\Column(length: 255, nullable: false)]
protected ?string $description = 'Unknown';
#[ORM\Column(length: 150, nullable: true)]
protected ?string $region = null;

View File

@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace App\Entity\Migration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20220421123900 extends AbstractMigration
{
public function getDescription(): string
{
return 'Fix nullability of extended Listener columns.';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE listener CHANGE device_browser_family device_browser_family VARCHAR(150) DEFAULT NULL, CHANGE device_os_family device_os_family VARCHAR(150) DEFAULT NULL');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE listener CHANGE device_browser_family device_browser_family VARCHAR(150) NOT NULL, CHANGE device_os_family device_os_family VARCHAR(150) NOT NULL');
}
}