<?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 Version20260407202410 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 advert_event (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, type VARCHAR(30) NOT NULL, details TEXT DEFAULT NULL, ip VARCHAR(45) DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, advert_id INT NOT NULL, PRIMARY KEY (id))');
        $this->addSql('CREATE INDEX idx_advert_event_advert ON advert_event (advert_id)');
        $this->addSql('CREATE INDEX idx_advert_event_type ON advert_event (type)');
        $this->addSql('ALTER TABLE advert_event ADD CONSTRAINT FK_338A17CBD07ECCB6 FOREIGN KEY (advert_id) REFERENCES advert (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 advert_event DROP CONSTRAINT FK_338A17CBD07ECCB6');
        $this->addSql('DROP TABLE advert_event');
    }
}
