work in progress

This commit is contained in:
Pol Dellaiera
2022-02-15 13:55:21 +01:00
parent 4822acb6fb
commit d780d95157
8 changed files with 61 additions and 12 deletions

View File

@@ -429,7 +429,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
/**
* The person's phonenumber.
*
* @ORM\Column(type="text")
* @ORM\Column(type="text", nullable=true)
* @Assert\Regex(
* pattern="/^([\+{1}])([0-9\s*]{4,20})$/",
* )
@@ -437,7 +437,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* type="landline",
* )
*/
private string $phonenumber = '';
private ?string $phonenumber = null;
/**
* The person's place of birth.
@@ -1298,7 +1298,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
/**
* Get phonenumber.
*/
public function getPhonenumber(): string
public function getPhonenumber(): ?string
{
return $this->phonenumber;
}

View File

@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace Chill\Migrations\Person;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use Exception;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220215135508 extends AbstractMigration
{
public function getDescription(): string
{
return 'Update phone numbers';
}
public function up(Schema $schema): void
{
$this->addSql('DROP INDEX phonenumber_trgm_idx');
$this->addSql('DROP INDEX mobilenumber_trgm_idx');
$this->addSql('ALTER TABLE chill_person_person ALTER phonenumber TYPE TEXT');
$this->addSql('ALTER TABLE chill_person_person ALTER phonenumber DROP DEFAULT');
$this->addSql('ALTER TABLE chill_person_person ALTER phonenumber DROP NOT NULL');
$this->addSql('ALTER TABLE chill_person_person ALTER mobilenumber TYPE TEXT');
$this->addSql('ALTER TABLE chill_person_person ALTER mobilenumber DROP DEFAULT');
$this->addSql('COMMENT ON COLUMN chill_person_person.phonenumber IS NULL');
$this->addSql('COMMENT ON COLUMN chill_person_person.mobilenumber IS NULL');
$this->addSql('ALTER TABLE chill_person_phone ALTER phonenumber TYPE TEXT');
$this->addSql('ALTER TABLE chill_person_phone ALTER phonenumber DROP DEFAULT');
$this->addSql('COMMENT ON COLUMN chill_person_phone.phonenumber IS NULL');
}
public function down(Schema $schema): void
{
throw new Exception('You should not do that.');
}
}