<?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 Version20260207010000 extends AbstractMigration
{
    public function getDescription(): string
    {
        return 'Create etat_lieux_point_control table';
    }

    public function up(Schema $schema): void
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->addSql('CREATE TABLE etat_lieux_point_control (id SERIAL NOT NULL, etat_lieux_id INT NOT NULL, name VARCHAR(255) NOT NULL, status BOOLEAN DEFAULT false NOT NULL, details TEXT DEFAULT NULL, PRIMARY KEY(id))');
        $this->addSql('CREATE INDEX IDX_ETAT_LIEUX_POINT_CONTROL ON etat_lieux_point_control (etat_lieux_id)');
        $this->addSql('ALTER TABLE etat_lieux_point_control ADD CONSTRAINT FK_ETAT_LIEUX_POINT_CONTROL FOREIGN KEY (etat_lieux_id) REFERENCES etat_lieux (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('ALTER TABLE etat_lieux_point_control DROP FOREIGN KEY FK_ETAT_LIEUX_POINT_CONTROL');
        $this->addSql('DROP TABLE etat_lieux_point_control');
    }
}
