Add new fields to AddressReference for update procedure

This commit is contained in:
nobohan 2022-03-25 15:14:13 +01:00
parent f24b2931dd
commit 58f1984c77
2 changed files with 98 additions and 0 deletions

View File

@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\MainBundle\Entity;
use Chill\MainBundle\Doctrine\Model\Point;
use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
@ -33,6 +34,18 @@ class AddressReference
*/
private string $addressCanonical = '';
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
* @groups({"read"})
*/
private ?DateTimeImmutable $createdAt = null;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
* @groups({"read"})
*/
private ?DateTimeImmutable $deletedAt = null;
/**
* @ORM\Id
* @ORM\GeneratedValue
@ -89,6 +102,22 @@ class AddressReference
*/
private $streetNumber;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
* @groups({"read"})
*/
private ?DateTimeImmutable $updatedAt = null;
public function getCreatedAt(): ?DateTimeImmutable
{
return $this->createdAt;
}
public function getDeletedAt(): ?DateTimeImmutable
{
return $this->deletedAt;
}
public function getId(): ?int
{
return $this->id;
@ -134,6 +163,25 @@ class AddressReference
return $this->streetNumber;
}
public function getUpdatedAt(): ?DateTimeImmutable
{
return $this->updatedAt;
}
public function setCreatedAt(?DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function setDeletedAt(?DateTimeImmutable $deletedAt): self
{
$this->deletedAt = $deletedAt;
return $this;
}
public function setMunicipalityCode(?string $municipalityCode): self
{
$this->municipalityCode = $municipalityCode;
@ -189,4 +237,11 @@ class AddressReference
return $this;
}
public function setUpdatedAt(?DateTimeImmutable $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
}

View File

@ -0,0 +1,43 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\Migrations\Main;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Add 3 fields on AddressReference.
*/
final class Version20220325134944 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_main_address_reference DROP createdAt');
$this->addSql('ALTER TABLE chill_main_address_reference DROP deletedAt');
$this->addSql('ALTER TABLE chill_main_address_reference DROP updatedAt');
}
public function getDescription(): string
{
return 'Add 3 fields on AddressReference';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_main_address_reference ADD createdAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
$this->addSql('ALTER TABLE chill_main_address_reference ADD deletedAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
$this->addSql('ALTER TABLE chill_main_address_reference ADD updatedAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
$this->addSql('COMMENT ON COLUMN chill_main_address_reference.createdAt IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN chill_main_address_reference.deletedAt IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN chill_main_address_reference.updatedAt IS \'(DC2Type:datetime_immutable)\'');
}
}