<?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 Version20241104151703 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 workshop_contributor (workshop_id INT NOT NULL, contributor_id INT NOT NULL, INDEX IDX_E730FCDD1FDCE57C (workshop_id), INDEX IDX_E730FCDD7A19A357 (contributor_id), PRIMARY KEY(workshop_id, contributor_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE workshop_contributor ADD CONSTRAINT FK_E730FCDD1FDCE57C FOREIGN KEY (workshop_id) REFERENCES workshop (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE workshop_contributor ADD CONSTRAINT FK_E730FCDD7A19A357 FOREIGN KEY (contributor_id) REFERENCES contributor (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE workshop DROP FOREIGN KEY FK_9B6F02C47A19A357');
$this->addSql('DROP INDEX IDX_9B6F02C47A19A357 ON workshop');
$this->addSql('ALTER TABLE workshop DROP contributor_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE workshop_contributor');
$this->addSql('ALTER TABLE workshop ADD contributor_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE workshop ADD CONSTRAINT FK_9B6F02C47A19A357 FOREIGN KEY (contributor_id) REFERENCES contributor (id) ON DELETE SET NULL');
$this->addSql('CREATE INDEX IDX_9B6F02C47A19A357 ON workshop (contributor_id)');
}
}