Entity Domain : - customer (ManyToOne, CASCADE) : client propriétaire du domaine - fqdn (unique) : nom de domaine complet, lowercase auto - registrar : bureau d'enregistrement (OVH, Gandi, etc.) - zoneCloudflare : statut zone Cloudflare (active, pending, etc.) - zoneIdCloudflare : identifiant zone Cloudflare - expiredAt : date d'expiration du domaine - isGestion : domaine géré par SITECONSEIL - isBilling : domaine facturé par SITECONSEIL - createdAt / updatedAt : timestamps - isExpired() : vérifie si le domaine est expiré - isExpiringSoon(days) : vérifie si expiration dans les N jours DomainTest (4 tests, 25 assertions) : - testConstructor : valeurs par défaut, fqdn lowercase/trim - testSetters : tous les setters/getters - testIsExpired : null/passé/futur - testIsExpiringSoon : null/15j (true pour 30j)/60j (false pour 30j) Migration : CREATE TABLE domain avec FK customer ON DELETE CASCADE Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
36 lines
1.6 KiB
PHP
36 lines
1.6 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 Version20260403220210 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 (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, fqdn VARCHAR(255) NOT NULL, registrar VARCHAR(255) DEFAULT NULL, zone_cloudflare VARCHAR(50) DEFAULT NULL, zone_id_cloudflare VARCHAR(100) DEFAULT NULL, expired_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, is_gestion BOOLEAN NOT NULL, is_billing BOOLEAN NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, customer_id INT NOT NULL, PRIMARY KEY (id))');
|
|
$this->addSql('CREATE UNIQUE INDEX UNIQ_A7A91E0BC1A19758 ON domain (fqdn)');
|
|
$this->addSql('CREATE INDEX IDX_A7A91E0B9395C3F3 ON domain (customer_id)');
|
|
$this->addSql('ALTER TABLE domain ADD CONSTRAINT FK_A7A91E0B9395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (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 DROP CONSTRAINT FK_A7A91E0B9395C3F3');
|
|
$this->addSql('DROP TABLE domain');
|
|
}
|
|
}
|