<?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 Version20260407120747 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_payment (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, type VARCHAR(20) NOT NULL, amount NUMERIC(10, 2) NOT NULL, method VARCHAR(30) 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_payment_advert ON advert_payment (advert_id)');
        $this->addSql('CREATE INDEX idx_advert_payment_type ON advert_payment (type)');
        $this->addSql('ALTER TABLE advert_payment ADD CONSTRAINT FK_C766C45BD07ECCB6 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_payment DROP CONSTRAINT FK_C766C45BD07ECCB6');
        $this->addSql('DROP TABLE advert_payment');
    }
}
