<?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 Version20260127091504 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('ALTER TABLE devis_line DROP CONSTRAINT fk_9ec6d5294584665a');
        $this->addSql('DROP INDEX idx_9ec6d5294584665a');
        $this->addSql('ALTER TABLE devis_line ADD product VARCHAR(255) NOT NULL');
        $this->addSql('ALTER TABLE devis_line DROP product_id');
    }

    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 devis_line ADD product_id INT DEFAULT NULL');
        $this->addSql('ALTER TABLE devis_line DROP product');
        $this->addSql('ALTER TABLE devis_line ADD CONSTRAINT fk_9ec6d5294584665a FOREIGN KEY (product_id) REFERENCES product (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
        $this->addSql('CREATE INDEX idx_9ec6d5294584665a ON devis_line (product_id)');
    }
}
