<?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 Version20250416131945 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(<<<'SQL'
            CREATE TABLE animal (id INT AUTO_INCREMENT NOT NULL, espece_id INT DEFAULT NULL, nom VARCHAR(255) NOT NULL, date_naissance DATE NOT NULL, date_mort DATE DEFAULT NULL, description LONGTEXT NOT NULL, pays VARCHAR(255) NOT NULL, poids DOUBLE PRECISION NOT NULL, taille DOUBLE PRECISION NOT NULL, photo LONGTEXT DEFAULT NULL, INDEX IDX_6AAB231F2D191E7A (espece_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
        SQL);
        $this->addSql(<<<'SQL'
            CREATE TABLE atelier (id INT AUTO_INCREMENT NOT NULL, nom VARCHAR(255) NOT NULL, description LONGTEXT NOT NULL, prix DOUBLE PRECISION NOT NULL, temps INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
        SQL);
        $this->addSql(<<<'SQL'
            CREATE TABLE disponibilite_atelier (id INT AUTO_INCREMENT NOT NULL, atelier_id INT DEFAULT NULL, date_dispo DATE NOT NULL, heure TIME NOT NULL, lieux VARCHAR(255) NOT NULL, INDEX IDX_96E79F6482E2CF35 (atelier_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
        SQL);
        $this->addSql(<<<'SQL'
            CREATE TABLE espece (id INT AUTO_INCREMENT NOT NULL, nom VARCHAR(255) NOT NULL, nom_scientifique VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
        SQL);
        $this->addSql(<<<'SQL'
            CREATE TABLE log (id INT AUTO_INCREMENT NOT NULL, date_log DATETIME NOT NULL, type_changement VARCHAR(255) NOT NULL, endroit VARCHAR(255) NOT NULL, qui_change VARCHAR(255) NOT NULL, commentaire VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
        SQL);
        $this->addSql(<<<'SQL'
            CREATE TABLE objet_panier (id INT AUTO_INCREMENT NOT NULL, produit_id INT DEFAULT NULL, panier_id INT DEFAULT NULL, prix DOUBLE PRECISION NOT NULL, INDEX IDX_9113E0D8F347EFB (produit_id), INDEX IDX_9113E0D8F77D927C (panier_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
        SQL);
        $this->addSql(<<<'SQL'
            CREATE TABLE panier (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, date_panier DATE NOT NULL, statut VARCHAR(255) NOT NULL, INDEX IDX_24CC0DF2A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
        SQL);
        $this->addSql(<<<'SQL'
            CREATE TABLE parrainage (id INT AUTO_INCREMENT NOT NULL, animal_id INT DEFAULT NULL, user_id INT DEFAULT NULL, date_debut DATE NOT NULL, date_fin DATE DEFAULT NULL, prix_abonnement DOUBLE PRECISION NOT NULL, INDEX IDX_195BAFB58E962C16 (animal_id), INDEX IDX_195BAFB5A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
        SQL);
        $this->addSql(<<<'SQL'
            CREATE TABLE produit (id INT AUTO_INCREMENT NOT NULL, nom VARCHAR(255) NOT NULL, prix DOUBLE PRECISION NOT NULL, description LONGTEXT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
        SQL);
        $this->addSql(<<<'SQL'
            CREATE TABLE qui_organise (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, dispo_atelier_id INT DEFAULT NULL, atelier_id INT DEFAULT NULL, INDEX IDX_ADFC892FA76ED395 (user_id), INDEX IDX_ADFC892FC9954F1B (dispo_atelier_id), INDEX IDX_ADFC892F82E2CF35 (atelier_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
        SQL);
        $this->addSql(<<<'SQL'
            CREATE TABLE qui_participe (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, atelier_id INT DEFAULT NULL, disponibilite_atelier_id INT DEFAULT NULL, INDEX IDX_588FDC65A76ED395 (user_id), INDEX IDX_588FDC6582E2CF35 (atelier_id), INDEX IDX_588FDC65E1284754 (disponibilite_atelier_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
        SQL);
        $this->addSql(<<<'SQL'
            CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(180) NOT NULL, roles JSON NOT NULL COMMENT '(DC2Type:json)', password VARCHAR(255) NOT NULL, nom VARCHAR(255) NOT NULL, prenom VARCHAR(255) NOT NULL, adresse VARCHAR(255) NOT NULL, telephone VARCHAR(50) NOT NULL, is_verified TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE animal ADD CONSTRAINT FK_6AAB231F2D191E7A FOREIGN KEY (espece_id) REFERENCES espece (id)
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE disponibilite_atelier ADD CONSTRAINT FK_96E79F6482E2CF35 FOREIGN KEY (atelier_id) REFERENCES atelier (id)
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE objet_panier ADD CONSTRAINT FK_9113E0D8F347EFB FOREIGN KEY (produit_id) REFERENCES produit (id)
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE objet_panier ADD CONSTRAINT FK_9113E0D8F77D927C FOREIGN KEY (panier_id) REFERENCES panier (id)
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE panier ADD CONSTRAINT FK_24CC0DF2A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE parrainage ADD CONSTRAINT FK_195BAFB58E962C16 FOREIGN KEY (animal_id) REFERENCES animal (id)
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE parrainage ADD CONSTRAINT FK_195BAFB5A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE qui_organise ADD CONSTRAINT FK_ADFC892FA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE qui_organise ADD CONSTRAINT FK_ADFC892FC9954F1B FOREIGN KEY (dispo_atelier_id) REFERENCES disponibilite_atelier (id)
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE qui_organise ADD CONSTRAINT FK_ADFC892F82E2CF35 FOREIGN KEY (atelier_id) REFERENCES atelier (id)
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE qui_participe ADD CONSTRAINT FK_588FDC65A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE qui_participe ADD CONSTRAINT FK_588FDC6582E2CF35 FOREIGN KEY (atelier_id) REFERENCES atelier (id)
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE qui_participe ADD CONSTRAINT FK_588FDC65E1284754 FOREIGN KEY (disponibilite_atelier_id) REFERENCES disponibilite_atelier (id)
        SQL);
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql(<<<'SQL'
            ALTER TABLE animal DROP FOREIGN KEY FK_6AAB231F2D191E7A
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE disponibilite_atelier DROP FOREIGN KEY FK_96E79F6482E2CF35
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE objet_panier DROP FOREIGN KEY FK_9113E0D8F347EFB
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE objet_panier DROP FOREIGN KEY FK_9113E0D8F77D927C
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE panier DROP FOREIGN KEY FK_24CC0DF2A76ED395
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE parrainage DROP FOREIGN KEY FK_195BAFB58E962C16
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE parrainage DROP FOREIGN KEY FK_195BAFB5A76ED395
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE qui_organise DROP FOREIGN KEY FK_ADFC892FA76ED395
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE qui_organise DROP FOREIGN KEY FK_ADFC892FC9954F1B
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE qui_organise DROP FOREIGN KEY FK_ADFC892F82E2CF35
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE qui_participe DROP FOREIGN KEY FK_588FDC65A76ED395
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE qui_participe DROP FOREIGN KEY FK_588FDC6582E2CF35
        SQL);
        $this->addSql(<<<'SQL'
            ALTER TABLE qui_participe DROP FOREIGN KEY FK_588FDC65E1284754
        SQL);
        $this->addSql(<<<'SQL'
            DROP TABLE animal
        SQL);
        $this->addSql(<<<'SQL'
            DROP TABLE atelier
        SQL);
        $this->addSql(<<<'SQL'
            DROP TABLE disponibilite_atelier
        SQL);
        $this->addSql(<<<'SQL'
            DROP TABLE espece
        SQL);
        $this->addSql(<<<'SQL'
            DROP TABLE log
        SQL);
        $this->addSql(<<<'SQL'
            DROP TABLE objet_panier
        SQL);
        $this->addSql(<<<'SQL'
            DROP TABLE panier
        SQL);
        $this->addSql(<<<'SQL'
            DROP TABLE parrainage
        SQL);
        $this->addSql(<<<'SQL'
            DROP TABLE produit
        SQL);
        $this->addSql(<<<'SQL'
            DROP TABLE qui_organise
        SQL);
        $this->addSql(<<<'SQL'
            DROP TABLE qui_participe
        SQL);
        $this->addSql(<<<'SQL'
            DROP TABLE user
        SQL);
    }
}
