Files
crm_ecosplay/migrations/Version20260403220445.php
Serreau Jovann 51585e33f8 feat: entité DomainEmail liée à Domain avec migration
Entity DomainEmail :
- domain (ManyToOne, CASCADE) : domaine parent
- name : partie locale de l'email (lowercase auto, ex: contact)
- state : active/suspended/disabled (défaut active)
- quotaMb : quota en Mo (défaut 5120 = 5 Go)
- createdAt / updatedAt : timestamps (updatedAt auto sur setState)
- getFullEmail() : retourne name@domain.fqdn
- isActive() : vérifie si state === active

DomainEmailTest (3 tests, 19 assertions) :
- testConstructor : valeurs par défaut, name lowercase/trim, fullEmail
- testSetters : name, quotaMb, updatedAt
- testState : active→suspended→disabled, updatedAt mis à jour

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 00:05:00 +02:00

35 lines
1.3 KiB
PHP

<?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 Version20260403220445 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('CREATE TABLE domain_email (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, name VARCHAR(255) NOT NULL, state VARCHAR(20) NOT NULL, quota_mb INT NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, domain_id INT NOT NULL, PRIMARY KEY (id))');
$this->addSql('CREATE INDEX IDX_34E954A2115F0EE5 ON domain_email (domain_id)');
$this->addSql('ALTER TABLE domain_email ADD CONSTRAINT FK_34E954A2115F0EE5 FOREIGN KEY (domain_id) REFERENCES domain (id) ON DELETE CASCADE NOT DEFERRABLE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE domain_email DROP CONSTRAINT FK_34E954A2115F0EE5');
$this->addSql('DROP TABLE domain_email');
}
}