<?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 Version20230710121303 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 user_role (
id INT AUTO_INCREMENT NOT NULL,
user_id INT NOT NULL,
role_id INT NOT NULL,
PRIMARY KEY (id),
UNIQUE INDEX UNIQ_54FCD59F9D86650F (user_id),
INDEX IDX_54FCD59FA76ED395 (role_id),
FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE,
FOREIGN KEY (role_id) REFERENCES roles (id) ON DELETE CASCADE
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE user_role DROP FOREIGN KEY FK_54FCD59F9D86650F');
$this->addSql('ALTER TABLE user_role_roles DROP FOREIGN KEY FK_3626B997D84AB5C4');
$this->addSql('ALTER TABLE user_role_roles DROP FOREIGN KEY FK_3626B99738C751C4');
$this->addSql('DROP TABLE user_role');
$this->addSql('DROP TABLE user_role_roles');
}
}