<?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 Version20240610134522 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 game_quiz_category_mapping (game_quiz_question_id INT NOT NULL, game_category_id INT NOT NULL, INDEX IDX_80C2772AF102203 (game_quiz_question_id), INDEX IDX_80C2772ACC13DFE0 (game_category_id), PRIMARY KEY(game_quiz_question_id, game_category_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE game_quiz_category_mapping ADD CONSTRAINT FK_80C2772AF102203 FOREIGN KEY (game_quiz_question_id) REFERENCES game_quiz_question (id)');
$this->addSql('ALTER TABLE game_quiz_category_mapping ADD CONSTRAINT FK_80C2772ACC13DFE0 FOREIGN KEY (game_category_id) REFERENCES game_category (id)');
$this->addSql('ALTER TABLE game_quiz_question DROP FOREIGN KEY FK_CAD72C60CC13DFE0');
$this->addSql('DROP INDEX IDX_CAD72C60CC13DFE0 ON game_quiz_question');
$this->addSql('ALTER TABLE game_quiz_question DROP game_category_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE game_quiz_category_mapping DROP FOREIGN KEY FK_80C2772AF102203');
$this->addSql('ALTER TABLE game_quiz_category_mapping DROP FOREIGN KEY FK_80C2772ACC13DFE0');
$this->addSql('DROP TABLE game_quiz_category_mapping');
$this->addSql('ALTER TABLE game_quiz_question ADD game_category_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE game_quiz_question ADD CONSTRAINT FK_CAD72C60CC13DFE0 FOREIGN KEY (game_category_id) REFERENCES game_category (id)');
$this->addSql('CREATE INDEX IDX_CAD72C60CC13DFE0 ON game_quiz_question (game_category_id)');
}
}