<?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 Version20250327132254 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 commentaire (id INT NOT NULL, etablissement_id INT NOT NULL, nom_auteur VARCHAR(255) NOT NULL, date_creation TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, note INT NOT NULL, texte TEXT NOT NULL, PRIMARY KEY(id))');
        $this->addSql('CREATE INDEX IDX_67F068BCFF631228 ON commentaire (etablissement_id)');
        $this->addSql('COMMENT ON COLUMN commentaire.date_creation IS \'(DC2Type:datetime_immutable)\'');
        $this->addSql('CREATE TABLE etablissement (id INT NOT NULL, numero_uai VARCHAR(255) NOT NULL, secteur VARCHAR(255) NOT NULL, appellation_officielle VARCHAR(255) NOT NULL, adresse VARCHAR(255) DEFAULT NULL, code_postal INT NOT NULL, commune VARCHAR(255) NOT NULL, latitude DOUBLE PRECISION NOT NULL, longitude DOUBLE PRECISION NOT NULL, nature_uai INT NOT NULL, nature_libe VARCHAR(255) NOT NULL, etat_etablissement_libe VARCHAR(255) NOT NULL, code_departement VARCHAR(255) NOT NULL, code_region INT NOT NULL, code_academie INT NOT NULL, code_commune VARCHAR(255) NOT NULL, departement VARCHAR(255) NOT NULL, region VARCHAR(255) NOT NULL, academie VARCHAR(255) NOT NULL, type_contrat INT DEFAULT NULL, libelle_type_contrat VARCHAR(255) DEFAULT NULL, code_ministere INT NOT NULL, libelle_ministere VARCHAR(255) NOT NULL, date_ouverture DATE NOT NULL, PRIMARY KEY(id))');
        $this->addSql('ALTER TABLE commentaire ADD CONSTRAINT FK_67F068BCFF631228 FOREIGN KEY (etablissement_id) REFERENCES etablissement (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 commentaire DROP CONSTRAINT FK_67F068BCFF631228');
        $this->addSql('DROP TABLE commentaire');
        $this->addSql('DROP TABLE etablissement');
    }
}
