<?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 Version20260122113118 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('DROP SEQUENCE contrat_line_id_seq CASCADE');
        $this->addSql('CREATE TABLE contrats_option (id SERIAL NOT NULL, contrat_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, price DOUBLE PRECISION NOT NULL, PRIMARY KEY(id))');
        $this->addSql('CREATE INDEX IDX_A4A2C35C1823061F ON contrats_option (contrat_id)');
        $this->addSql('ALTER TABLE contrats_option ADD CONSTRAINT FK_A4A2C35C1823061F FOREIGN KEY (contrat_id) REFERENCES contrats (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
        $this->addSql('ALTER TABLE contrat_line DROP CONSTRAINT fk_9c4011e81823061f');
        $this->addSql('DROP TABLE contrat_line');
    }

    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('CREATE SEQUENCE contrat_line_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
        $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('ALTER TABLE contrat_line ADD CONSTRAINT fk_9c4011e81823061f FOREIGN KEY (contrat_id) REFERENCES contrats (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
        $this->addSql('ALTER TABLE contrats_option DROP CONSTRAINT FK_A4A2C35C1823061F');
        $this->addSql('DROP TABLE contrats_option');
    }
}
