<?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');
    }
}
