Correction

This commit is contained in:
Charles 2025-07-16 15:04:35 +02:00
parent 8f232498b8
commit 10a8eb2255
2 changed files with 52 additions and 4 deletions

View File

@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250716083017 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE users_organizations ADD created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP');
$this->addSql('COMMENT ON COLUMN users_organizations.created_at IS \'(DC2Type:datetime_immutable)\'');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE users_organizations DROP created_at');
}
}

View File

@ -21,21 +21,24 @@ class UsersOrganizations
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?organizations $organization = null;
private ?Organizations $organization = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?roles $role = null;
private ?Roles $role = null;
#[ORM\Column(options: ['default' => true])]
private ?bool $isActive = null;
/**
* @var Collection<int, apps>
* @var Collection<int, Apps>
*/
#[ORM\ManyToMany(targetEntity: apps::class)]
#[ORM\ManyToMany(targetEntity: Apps::class)]
private Collection $apps;
#[ORM\Column(nullable:true, options: ['default' => 'CURRENT_TIMESTAMP'])]
private ?\DateTimeImmutable $createdAt = null;
public function __construct()
{
$this->apps = new ArrayCollection();
@ -117,4 +120,16 @@ class UsersOrganizations
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeImmutable $createdAt): static
{
$this->createdAt = $createdAt;
return $this;
}
}