<?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 Version20240610122658 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_category (id INT AUTO_INCREMENT NOT NULL, category_name VARCHAR(191) NOT NULL, category_letter VARCHAR(191) DEFAULT NULL, is_active TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE game_quiz_question DROP FOREIGN KEY FK_CAD72C6010FEAE5A');
$this->addSql('ALTER TABLE game_quiz_question DROP FOREIGN KEY FK_CAD72C60780B43E2');
$this->addSql('DROP INDEX IDX_CAD72C60780B43E2 ON game_quiz_question');
$this->addSql('DROP INDEX IDX_CAD72C6010FEAE5A ON game_quiz_question');
$this->addSql('ALTER TABLE game_quiz_question ADD game_category_id INT DEFAULT NULL, DROP game_quiz_question_category_id, DROP game_quiz_id');
$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)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE game_quiz_question DROP FOREIGN KEY FK_CAD72C60CC13DFE0');
$this->addSql('DROP TABLE game_category');
$this->addSql('DROP INDEX IDX_CAD72C60CC13DFE0 ON game_quiz_question');
$this->addSql('ALTER TABLE game_quiz_question ADD game_quiz_id INT DEFAULT NULL, CHANGE game_category_id game_quiz_question_category_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE game_quiz_question ADD CONSTRAINT FK_CAD72C6010FEAE5A FOREIGN KEY (game_quiz_id) REFERENCES game_quiz (id)');
$this->addSql('ALTER TABLE game_quiz_question ADD CONSTRAINT FK_CAD72C60780B43E2 FOREIGN KEY (game_quiz_question_category_id) REFERENCES game_quiz_question_category (id)');
$this->addSql('CREATE INDEX IDX_CAD72C60780B43E2 ON game_quiz_question (game_quiz_question_category_id)');
$this->addSql('CREATE INDEX IDX_CAD72C6010FEAE5A ON game_quiz_question (game_quiz_id)');
}
}