<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
final class Version20211202192513 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 mallette_file (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, date DATETIME DEFAULT NULL, upload_date DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE mallette_file_group (mallette_file_id INT NOT NULL, group_id INT NOT NULL, INDEX IDX_71E1A39780E9FB39 (mallette_file_id), INDEX IDX_71E1A397FE54D947 (group_id), PRIMARY KEY(mallette_file_id, group_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE mallette_file_client (mallette_file_id INT NOT NULL, client_id INT NOT NULL, INDEX IDX_423D156A80E9FB39 (mallette_file_id), INDEX IDX_423D156A19EB6921 (client_id), PRIMARY KEY(mallette_file_id, client_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE mallette_file_category (mallette_file_id INT NOT NULL, category_id INT NOT NULL, INDEX IDX_3422967680E9FB39 (mallette_file_id), INDEX IDX_3422967612469DE2 (category_id), PRIMARY KEY(mallette_file_id, category_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE mallette_file_app_user (mallette_file_id INT NOT NULL, app_user_id INT NOT NULL, INDEX IDX_BAD37C5E80E9FB39 (mallette_file_id), INDEX IDX_BAD37C5E4A3353D8 (app_user_id), PRIMARY KEY(mallette_file_id, app_user_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE mallette_file_group ADD CONSTRAINT FK_71E1A39780E9FB39 FOREIGN KEY (mallette_file_id) REFERENCES mallette_file (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE mallette_file_group ADD CONSTRAINT FK_71E1A397FE54D947 FOREIGN KEY (group_id) REFERENCES `mallette_group` (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE mallette_file_client ADD CONSTRAINT FK_423D156A80E9FB39 FOREIGN KEY (mallette_file_id) REFERENCES mallette_file (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE mallette_file_client ADD CONSTRAINT FK_423D156A19EB6921 FOREIGN KEY (client_id) REFERENCES `mallette_client` (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE mallette_file_category ADD CONSTRAINT FK_3422967680E9FB39 FOREIGN KEY (mallette_file_id) REFERENCES mallette_file (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE mallette_file_category ADD CONSTRAINT FK_3422967612469DE2 FOREIGN KEY (category_id) REFERENCES `mallette_category` (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE mallette_file_app_user ADD CONSTRAINT FK_BAD37C5E80E9FB39 FOREIGN KEY (mallette_file_id) REFERENCES mallette_file (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE mallette_file_app_user ADD CONSTRAINT FK_BAD37C5E4A3353D8 FOREIGN KEY (app_user_id) REFERENCES eckinox_app_users (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE mallette_file_group DROP FOREIGN KEY FK_71E1A39780E9FB39');
$this->addSql('ALTER TABLE mallette_file_client DROP FOREIGN KEY FK_423D156A80E9FB39');
$this->addSql('ALTER TABLE mallette_file_category DROP FOREIGN KEY FK_3422967680E9FB39');
$this->addSql('ALTER TABLE mallette_file_app_user DROP FOREIGN KEY FK_BAD37C5E80E9FB39');
$this->addSql('DROP TABLE mallette_file');
$this->addSql('DROP TABLE mallette_file_group');
$this->addSql('DROP TABLE mallette_file_client');
$this->addSql('DROP TABLE mallette_file_category');
$this->addSql('DROP TABLE mallette_file_app_user');
}
public function isTransactional(): bool
{
return false;
}
}