<?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 Version20210531143333 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 collectif_data (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, territory_id INT DEFAULT NULL, nb_participant INT NOT NULL, INDEX IDX_F35F8503A76ED395 (user_id), INDEX IDX_F35F850373F74AD4 (territory_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('CREATE TABLE configuration (id INT AUTO_INCREMENT NOT NULL, value VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('CREATE TABLE dreams (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, collectif_data_id INT DEFAULT NULL, INDEX IDX_FD07CC0AE2920B1 (individual_data_id), INDEX IDX_FD07CC0AD9275BF1 (collectif_data_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('CREATE TABLE individual_data (id INT AUTO_INCREMENT NOT NULL, firstname VARCHAR(255) NOT NULL, lastname VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, intro_question VARCHAR(255) NOT NULL, intro_answer VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('CREATE TABLE projects_boost (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, collectif_data_id INT DEFAULT NULL, INDEX IDX_C3E57356E2920B1 (individual_data_id), INDEX IDX_C3E57356D9275BF1 (collectif_data_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('CREATE TABLE projects_inspiring (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, collectif_data_id INT DEFAULT NULL, INDEX IDX_E60CAEC6E2920B1 (individual_data_id), INDEX IDX_E60CAEC6D9275BF1 (collectif_data_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('CREATE TABLE revolts (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, collectif_data_id INT DEFAULT NULL, INDEX IDX_68E7DC9FE2920B1 (individual_data_id), INDEX IDX_68E7DC9FD9275BF1 (collectif_data_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('CREATE TABLE territory (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, INDEX IDX_E9743966E2920B1 (individual_data_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('CREATE TABLE thematic (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('ALTER TABLE collectif_data ADD CONSTRAINT FK_F35F8503A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
        $this->addSql('ALTER TABLE collectif_data ADD CONSTRAINT FK_F35F850373F74AD4 FOREIGN KEY (territory_id) REFERENCES territory (id)');
        $this->addSql('ALTER TABLE dreams ADD CONSTRAINT FK_FD07CC0AE2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)');
        $this->addSql('ALTER TABLE dreams ADD CONSTRAINT FK_FD07CC0AD9275BF1 FOREIGN KEY (collectif_data_id) REFERENCES collectif_data (id)');
        $this->addSql('ALTER TABLE projects_boost ADD CONSTRAINT FK_C3E57356E2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)');
        $this->addSql('ALTER TABLE projects_boost ADD CONSTRAINT FK_C3E57356D9275BF1 FOREIGN KEY (collectif_data_id) REFERENCES collectif_data (id)');
        $this->addSql('ALTER TABLE projects_inspiring ADD CONSTRAINT FK_E60CAEC6E2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)');
        $this->addSql('ALTER TABLE projects_inspiring ADD CONSTRAINT FK_E60CAEC6D9275BF1 FOREIGN KEY (collectif_data_id) REFERENCES collectif_data (id)');
        $this->addSql('ALTER TABLE revolts ADD CONSTRAINT FK_68E7DC9FE2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)');
        $this->addSql('ALTER TABLE revolts ADD CONSTRAINT FK_68E7DC9FD9275BF1 FOREIGN KEY (collectif_data_id) REFERENCES collectif_data (id)');
        $this->addSql('ALTER TABLE territory ADD CONSTRAINT FK_E9743966E2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)');
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE dreams DROP FOREIGN KEY FK_FD07CC0AD9275BF1');
        $this->addSql('ALTER TABLE projects_boost DROP FOREIGN KEY FK_C3E57356D9275BF1');
        $this->addSql('ALTER TABLE projects_inspiring DROP FOREIGN KEY FK_E60CAEC6D9275BF1');
        $this->addSql('ALTER TABLE revolts DROP FOREIGN KEY FK_68E7DC9FD9275BF1');
        $this->addSql('ALTER TABLE dreams DROP FOREIGN KEY FK_FD07CC0AE2920B1');
        $this->addSql('ALTER TABLE projects_boost DROP FOREIGN KEY FK_C3E57356E2920B1');
        $this->addSql('ALTER TABLE projects_inspiring DROP FOREIGN KEY FK_E60CAEC6E2920B1');
        $this->addSql('ALTER TABLE revolts DROP FOREIGN KEY FK_68E7DC9FE2920B1');
        $this->addSql('ALTER TABLE territory DROP FOREIGN KEY FK_E9743966E2920B1');
        $this->addSql('ALTER TABLE collectif_data DROP FOREIGN KEY FK_F35F850373F74AD4');
        $this->addSql('DROP TABLE collectif_data');
        $this->addSql('DROP TABLE configuration');
        $this->addSql('DROP TABLE dreams');
        $this->addSql('DROP TABLE individual_data');
        $this->addSql('DROP TABLE projects_boost');
        $this->addSql('DROP TABLE projects_inspiring');
        $this->addSql('DROP TABLE revolts');
        $this->addSql('DROP TABLE territory');
        $this->addSql('DROP TABLE thematic');
    }
}
