<?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 Version20220120101632 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 activity (id INT AUTO_INCREMENT NOT NULL, managers_id INT NOT NULL, users_id INT DEFAULT NULL, company_id INT NOT NULL, name VARCHAR(255) NOT NULL, url_name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_AC74095A33B2B3F3 (managers_id), UNIQUE INDEX UNIQ_AC74095A67B3B43D (users_id), INDEX IDX_AC74095A979B1AD6 (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE activity_registration_request (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, activity_id INT NOT NULL, INDEX IDX_3EDA6581A76ED395 (user_id), INDEX IDX_3EDA658181C06096 (activity_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE company (id INT AUTO_INCREMENT NOT NULL, administrators_id INT NOT NULL, managers_id INT DEFAULT NULL, users_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, url_name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_4FBF094FD5E2D82F (administrators_id), UNIQUE INDEX UNIQ_4FBF094F33B2B3F3 (managers_id), UNIQUE INDEX UNIQ_4FBF094F67B3B43D (users_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE company_registration_request (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, company_id INT NOT NULL, INDEX IDX_26D5ACAFA76ED395 (user_id), INDEX IDX_26D5ACAF979B1AD6 (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE division (id INT AUTO_INCREMENT NOT NULL, users_id INT DEFAULT NULL, session_id INT NOT NULL, name VARCHAR(255) NOT NULL, url_name VARCHAR(255) NOT NULL, parameters JSON DEFAULT NULL, UNIQUE INDEX UNIQ_1017471467B3B43D (users_id), INDEX IDX_10174714613FECDF (session_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE `group` (id INT AUTO_INCREMENT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE group_user (group_id INT NOT NULL, user_id INT NOT NULL, INDEX IDX_A4C98D39FE54D947 (group_id), INDEX IDX_A4C98D39A76ED395 (user_id), PRIMARY KEY(group_id, user_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE session (id INT AUTO_INCREMENT NOT NULL, users_id INT DEFAULT NULL, activity_id INT NOT NULL, name VARCHAR(255) NOT NULL, url_name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_D044D5D467B3B43D (users_id), INDEX IDX_D044D5D481C06096 (activity_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE activity ADD CONSTRAINT FK_AC74095A33B2B3F3 FOREIGN KEY (managers_id) REFERENCES `group` (id)');
$this->addSql('ALTER TABLE activity ADD CONSTRAINT FK_AC74095A67B3B43D FOREIGN KEY (users_id) REFERENCES `group` (id)');
$this->addSql('ALTER TABLE activity ADD CONSTRAINT FK_AC74095A979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id)');
$this->addSql('ALTER TABLE activity_registration_request ADD CONSTRAINT FK_3EDA6581A76ED395 FOREIGN KEY (user_id) REFERENCES `user` (id)');
$this->addSql('ALTER TABLE activity_registration_request ADD CONSTRAINT FK_3EDA658181C06096 FOREIGN KEY (activity_id) REFERENCES activity (id)');
$this->addSql('ALTER TABLE company ADD CONSTRAINT FK_4FBF094FD5E2D82F FOREIGN KEY (administrators_id) REFERENCES `group` (id)');
$this->addSql('ALTER TABLE company ADD CONSTRAINT FK_4FBF094F33B2B3F3 FOREIGN KEY (managers_id) REFERENCES `group` (id)');
$this->addSql('ALTER TABLE company ADD CONSTRAINT FK_4FBF094F67B3B43D FOREIGN KEY (users_id) REFERENCES `group` (id)');
$this->addSql('ALTER TABLE company_registration_request ADD CONSTRAINT FK_26D5ACAFA76ED395 FOREIGN KEY (user_id) REFERENCES `user` (id)');
$this->addSql('ALTER TABLE company_registration_request ADD CONSTRAINT FK_26D5ACAF979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id)');
$this->addSql('ALTER TABLE division ADD CONSTRAINT FK_1017471467B3B43D FOREIGN KEY (users_id) REFERENCES `group` (id)');
$this->addSql('ALTER TABLE division ADD CONSTRAINT FK_10174714613FECDF FOREIGN KEY (session_id) REFERENCES session (id)');
$this->addSql('ALTER TABLE group_user ADD CONSTRAINT FK_A4C98D39FE54D947 FOREIGN KEY (group_id) REFERENCES `group` (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE group_user ADD CONSTRAINT FK_A4C98D39A76ED395 FOREIGN KEY (user_id) REFERENCES `user` (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE session ADD CONSTRAINT FK_D044D5D467B3B43D FOREIGN KEY (users_id) REFERENCES `group` (id)');
$this->addSql('ALTER TABLE session ADD CONSTRAINT FK_D044D5D481C06096 FOREIGN KEY (activity_id) REFERENCES activity (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE activity_registration_request DROP FOREIGN KEY FK_3EDA658181C06096');
$this->addSql('ALTER TABLE session DROP FOREIGN KEY FK_D044D5D481C06096');
$this->addSql('ALTER TABLE activity DROP FOREIGN KEY FK_AC74095A979B1AD6');
$this->addSql('ALTER TABLE company_registration_request DROP FOREIGN KEY FK_26D5ACAF979B1AD6');
$this->addSql('ALTER TABLE activity DROP FOREIGN KEY FK_AC74095A33B2B3F3');
$this->addSql('ALTER TABLE activity DROP FOREIGN KEY FK_AC74095A67B3B43D');
$this->addSql('ALTER TABLE company DROP FOREIGN KEY FK_4FBF094FD5E2D82F');
$this->addSql('ALTER TABLE company DROP FOREIGN KEY FK_4FBF094F33B2B3F3');
$this->addSql('ALTER TABLE company DROP FOREIGN KEY FK_4FBF094F67B3B43D');
$this->addSql('ALTER TABLE division DROP FOREIGN KEY FK_1017471467B3B43D');
$this->addSql('ALTER TABLE group_user DROP FOREIGN KEY FK_A4C98D39FE54D947');
$this->addSql('ALTER TABLE session DROP FOREIGN KEY FK_D044D5D467B3B43D');
$this->addSql('ALTER TABLE division DROP FOREIGN KEY FK_10174714613FECDF');
$this->addSql('DROP TABLE activity');
$this->addSql('DROP TABLE activity_registration_request');
$this->addSql('DROP TABLE company');
$this->addSql('DROP TABLE company_registration_request');
$this->addSql('DROP TABLE division');
$this->addSql('DROP TABLE `group`');
$this->addSql('DROP TABLE group_user');
$this->addSql('DROP TABLE session');
}
}