<?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 Version20260122105631 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 contrat_line (id SERIAL NOT NULL, contrat_id INT DEFAULT NULL, PRIMARY KEY(id))');
        $this->addSql('CREATE INDEX IDX_9C4011E81823061F ON contrat_line (contrat_id)');
        $this->addSql('CREATE TABLE product_doc (id SERIAL NOT NULL, product_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, is_public BOOLEAN NOT NULL, PRIMARY KEY(id))');
        $this->addSql('CREATE INDEX IDX_666EA97B4584665A ON product_doc (product_id)');
        $this->addSql('ALTER TABLE contrat_line ADD CONSTRAINT FK_9C4011E81823061F FOREIGN KEY (contrat_id) REFERENCES contrats (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
        $this->addSql('ALTER TABLE product_doc ADD CONSTRAINT FK_666EA97B4584665A 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 contrat_line DROP CONSTRAINT FK_9C4011E81823061F');
        $this->addSql('ALTER TABLE product_doc DROP CONSTRAINT FK_666EA97B4584665A');
        $this->addSql('DROP TABLE contrat_line');
        $this->addSql('DROP TABLE product_doc');
    }
}
