<?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 Version20210910100012 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('ALTER TABLE request_comment DROP FOREIGN KEY FK_BE50203B427EB8A5');
$this->addSql('ALTER TABLE request_file DROP FOREIGN KEY FK_F33811EA427EB8A5');
$this->addSql('ALTER TABLE request DROP FOREIGN KEY FK_3B978F9F75A68C6C');
$this->addSql('CREATE TABLE demand (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, demand_information_id INT NOT NULL, status INT NOT NULL, description LONGTEXT NOT NULL, step INT NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_428D7973A76ED395 (user_id), UNIQUE INDEX UNIQ_428D79739A8FFC58 (demand_information_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE demand_comment (id INT AUTO_INCREMENT NOT NULL, demand_id INT NOT NULL, content LONGTEXT NOT NULL, status INT DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_3B0EBCB55D022E59 (demand_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE demand_file (id INT AUTO_INCREMENT NOT NULL, demand_id INT NOT NULL, file_id INT NOT NULL, type INT NOT NULL, INDEX IDX_525D96565D022E59 (demand_id), UNIQUE INDEX UNIQ_525D965693CB796C (file_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE demand_information (id INT AUTO_INCREMENT NOT NULL, lastname VARCHAR(255) NOT NULL, firstname VARCHAR(255) NOT NULL, date_of_birth DATE NOT NULL, address VARCHAR(255) NOT NULL, city VARCHAR(255) NOT NULL, postal_code INT NOT NULL, phone VARCHAR(10) NOT NULL, additional_address VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE demand ADD CONSTRAINT FK_428D7973A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE demand ADD CONSTRAINT FK_428D79739A8FFC58 FOREIGN KEY (demand_information_id) REFERENCES demand_information (id)');
$this->addSql('ALTER TABLE demand_comment ADD CONSTRAINT FK_3B0EBCB55D022E59 FOREIGN KEY (demand_id) REFERENCES demand (id)');
$this->addSql('ALTER TABLE demand_file ADD CONSTRAINT FK_525D96565D022E59 FOREIGN KEY (demand_id) REFERENCES demand (id)');
$this->addSql('ALTER TABLE demand_file ADD CONSTRAINT FK_525D965693CB796C FOREIGN KEY (file_id) REFERENCES file (id)');
$this->addSql('DROP TABLE request');
$this->addSql('DROP TABLE request_comment');
$this->addSql('DROP TABLE request_file');
$this->addSql('DROP TABLE request_information');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE demand_comment DROP FOREIGN KEY FK_3B0EBCB55D022E59');
$this->addSql('ALTER TABLE demand_file DROP FOREIGN KEY FK_525D96565D022E59');
$this->addSql('ALTER TABLE demand DROP FOREIGN KEY FK_428D79739A8FFC58');
$this->addSql('CREATE TABLE request (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, request_information_id INT NOT NULL, status INT NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', description LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, step INT NOT NULL, INDEX IDX_3B978F9FA76ED395 (user_id), UNIQUE INDEX UNIQ_3B978F9F75A68C6C (request_information_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('CREATE TABLE request_comment (id INT AUTO_INCREMENT NOT NULL, request_id INT NOT NULL, content LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, status INT DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_BE50203B427EB8A5 (request_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('CREATE TABLE request_file (id INT AUTO_INCREMENT NOT NULL, request_id INT NOT NULL, file_id INT NOT NULL, type INT NOT NULL, INDEX IDX_F33811EA427EB8A5 (request_id), UNIQUE INDEX UNIQ_F33811EA93CB796C (file_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('CREATE TABLE request_information (id INT AUTO_INCREMENT NOT NULL, lastname VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, firstname VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, date_of_birth DATE NOT NULL, address VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, city VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, postal_code INT NOT NULL, phone VARCHAR(10) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, additional_address VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE request ADD CONSTRAINT FK_3B978F9F75A68C6C FOREIGN KEY (request_information_id) REFERENCES request_information (id)');
$this->addSql('ALTER TABLE request ADD CONSTRAINT FK_3B978F9FA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE request_comment ADD CONSTRAINT FK_BE50203B427EB8A5 FOREIGN KEY (request_id) REFERENCES request (id)');
$this->addSql('ALTER TABLE request_file ADD CONSTRAINT FK_F33811EA427EB8A5 FOREIGN KEY (request_id) REFERENCES request (id)');
$this->addSql('ALTER TABLE request_file ADD CONSTRAINT FK_F33811EA93CB796C FOREIGN KEY (file_id) REFERENCES file (id)');
$this->addSql('DROP TABLE demand');
$this->addSql('DROP TABLE demand_comment');
$this->addSql('DROP TABLE demand_file');
$this->addSql('DROP TABLE demand_information');
}
}