<?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 Version20220722173423 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 history (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, requests_id INT DEFAULT NULL, commentaires LONGTEXT DEFAULT NULL, date DATETIME DEFAULT NULL, type VARCHAR(255) DEFAULT NULL, designation VARCHAR(255) DEFAULT NULL, INDEX IDX_27BA704BA76ED395 (user_id), INDEX IDX_27BA704B418F94FA (requests_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE requests (id INT AUTO_INCREMENT NOT NULL, user_request_id INT DEFAULT NULL, requirement VARCHAR(255) DEFAULT NULL, ended_at DATE DEFAULT NULL, details LONGTEXT DEFAULT NULL, status VARCHAR(255) DEFAULT NULL, slug VARCHAR(255) DEFAULT NULL, INDEX IDX_7B85D651E5197E49 (user_request_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE require_documents (id INT AUTO_INCREMENT NOT NULL, requests_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, path VARCHAR(255) NOT NULL, created_at DATE NOT NULL, status VARCHAR(255) DEFAULT NULL, INDEX IDX_87266DB0418F94FA (requests_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE `user` (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(180) DEFAULT NULL, roles LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', password VARCHAR(255) DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, number VARCHAR(255) DEFAULT NULL, location VARCHAR(255) DEFAULT NULL, position VARCHAR(255) DEFAULT NULL, profile VARCHAR(255) DEFAULT NULL, locked TINYINT(1) DEFAULT NULL, token VARCHAR(255) DEFAULT NULL, certificate VARCHAR(255) DEFAULT NULL, picture VARCHAR(255) DEFAULT NULL, id_card VARCHAR(255) DEFAULT NULL, card_number VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE history ADD CONSTRAINT FK_27BA704BA76ED395 FOREIGN KEY (user_id) REFERENCES `user` (id)');
$this->addSql('ALTER TABLE history ADD CONSTRAINT FK_27BA704B418F94FA FOREIGN KEY (requests_id) REFERENCES requests (id)');
$this->addSql('ALTER TABLE requests ADD CONSTRAINT FK_7B85D651E5197E49 FOREIGN KEY (user_request_id) REFERENCES `user` (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE require_documents ADD CONSTRAINT FK_87266DB0418F94FA FOREIGN KEY (requests_id) REFERENCES requests (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE history DROP FOREIGN KEY FK_27BA704B418F94FA');
$this->addSql('ALTER TABLE require_documents DROP FOREIGN KEY FK_87266DB0418F94FA');
$this->addSql('ALTER TABLE history DROP FOREIGN KEY FK_27BA704BA76ED395');
$this->addSql('ALTER TABLE requests DROP FOREIGN KEY FK_7B85D651E5197E49');
$this->addSql('DROP TABLE history');
$this->addSql('DROP TABLE requests');
$this->addSql('DROP TABLE require_documents');
$this->addSql('DROP TABLE `user`');
}
}