diff --git a/migrations/Version20250716083017.php b/migrations/Version20250716083017.php new file mode 100644 index 0000000..4820c07 --- /dev/null +++ b/migrations/Version20250716083017.php @@ -0,0 +1,33 @@ +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'); + } +} diff --git a/src/Entity/UsersOrganizations.php b/src/Entity/UsersOrganizations.php index 84f1da3..0e27cb0 100644 --- a/src/Entity/UsersOrganizations.php +++ b/src/Entity/UsersOrganizations.php @@ -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 + * @var Collection */ - #[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; + } }