<?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 Version20260128075215 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 formules (id SERIAL NOT NULL, name VARCHAR(255) NOT NULL, image_name VARCHAR(255) DEFAULT NULL, image_size INT DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, type VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
        $this->addSql('COMMENT ON COLUMN formules.updated_at IS \'(DC2Type:datetime_immutable)\'');
        $this->addSql('CREATE TABLE formules_product_inclus (id SERIAL NOT NULL, formules_id INT DEFAULT NULL, product_id INT DEFAULT NULL, config TEXT NOT NULL, PRIMARY KEY(id))');
        $this->addSql('CREATE INDEX IDX_BD36A828168F3793 ON formules_product_inclus (formules_id)');
        $this->addSql('CREATE INDEX IDX_BD36A8284584665A ON formules_product_inclus (product_id)');
        $this->addSql('COMMENT ON COLUMN formules_product_inclus.config IS \'(DC2Type:array)\'');
        $this->addSql('ALTER TABLE formules_product_inclus ADD CONSTRAINT FK_BD36A828168F3793 FOREIGN KEY (formules_id) REFERENCES formules (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
        $this->addSql('ALTER TABLE formules_product_inclus ADD CONSTRAINT FK_BD36A8284584665A FOREIGN KEY (product_id) REFERENCES product (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('CREATE SCHEMA public');
        $this->addSql('ALTER TABLE formules_product_inclus DROP CONSTRAINT FK_BD36A828168F3793');
        $this->addSql('ALTER TABLE formules_product_inclus DROP CONSTRAINT FK_BD36A8284584665A');
        $this->addSql('DROP TABLE formules');
        $this->addSql('DROP TABLE formules_product_inclus');
    }
}
