<?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 Version20260212074558 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 etat_lieux_return_point_control (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, name VARCHAR(255) NOT NULL, status BOOLEAN DEFAULT false NOT NULL, details TEXT DEFAULT NULL, etat_lieux_id INT NOT NULL, PRIMARY KEY (id))');
        $this->addSql('CREATE INDEX IDX_2EADBB563F1DAE3C ON etat_lieux_return_point_control (etat_lieux_id)');
        $this->addSql('CREATE TABLE etat_return_lieux_file (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, file_name VARCHAR(255) DEFAULT NULL, file_size INT DEFAULT NULL, mime_type VARCHAR(255) DEFAULT NULL, type VARCHAR(50) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, etat_lieux_id INT NOT NULL, PRIMARY KEY (id))');
        $this->addSql('CREATE INDEX IDX_2E89E9D43F1DAE3C ON etat_return_lieux_file (etat_lieux_id)');
        $this->addSql('ALTER TABLE etat_lieux_return_point_control ADD CONSTRAINT FK_2EADBB563F1DAE3C FOREIGN KEY (etat_lieux_id) REFERENCES etat_lieux (id) NOT DEFERRABLE');
        $this->addSql('ALTER TABLE etat_return_lieux_file ADD CONSTRAINT FK_2E89E9D43F1DAE3C FOREIGN KEY (etat_lieux_id) REFERENCES etat_lieux (id) NOT DEFERRABLE');
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE etat_lieux_return_point_control DROP CONSTRAINT FK_2EADBB563F1DAE3C');
        $this->addSql('ALTER TABLE etat_return_lieux_file DROP CONSTRAINT FK_2E89E9D43F1DAE3C');
        $this->addSql('DROP TABLE etat_lieux_return_point_control');
        $this->addSql('DROP TABLE etat_return_lieux_file');
    }
}
