migrations/Version20230527012122.php line 1
<?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 Version20230527012122 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 group_user_organization_user (group_user_id INT NOT NULL, organization_user_id INT NOT NULL, PRIMARY KEY(group_user_id, organization_user_id))');
$this->addSql('CREATE INDEX IDX_B82D749D216E8799 ON group_user_organization_user (group_user_id)');
$this->addSql('CREATE INDEX IDX_B82D749D6ABC5BD6 ON group_user_organization_user (organization_user_id)');
$this->addSql('CREATE TABLE user_user (user_source INT NOT NULL, user_target INT NOT NULL, PRIMARY KEY(user_source, user_target))');
$this->addSql('CREATE INDEX IDX_F7129A803AD8644E ON user_user (user_source)');
$this->addSql('CREATE INDEX IDX_F7129A80233D34C1 ON user_user (user_target)');
$this->addSql('ALTER TABLE group_user_organization_user ADD CONSTRAINT FK_B82D749D216E8799 FOREIGN KEY (group_user_id) REFERENCES group_user (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE group_user_organization_user ADD CONSTRAINT FK_B82D749D6ABC5BD6 FOREIGN KEY (organization_user_id) REFERENCES organization_user (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE user_user ADD CONSTRAINT FK_F7129A803AD8644E FOREIGN KEY (user_source) REFERENCES "user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE user_user ADD CONSTRAINT FK_F7129A80233D34C1 FOREIGN KEY (user_target) REFERENCES "user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE group_user_organization_user DROP CONSTRAINT FK_B82D749D216E8799');
$this->addSql('ALTER TABLE group_user_organization_user DROP CONSTRAINT FK_B82D749D6ABC5BD6');
$this->addSql('ALTER TABLE user_user DROP CONSTRAINT FK_F7129A803AD8644E');
$this->addSql('ALTER TABLE user_user DROP CONSTRAINT FK_F7129A80233D34C1');
$this->addSql('DROP TABLE group_user_organization_user');
$this->addSql('DROP TABLE user_user');
}
}