<?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 Version20220124114530 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 oimmei_phrase_category (oimmei_phrase_id INT NOT NULL, category_id INT NOT NULL, PRIMARY KEY(oimmei_phrase_id, category_id))');
$this->addSql('CREATE INDEX IDX_334CC23EAEAB3C7C ON oimmei_phrase_category (oimmei_phrase_id)');
$this->addSql('CREATE INDEX IDX_334CC23E12469DE2 ON oimmei_phrase_category (category_id)');
$this->addSql('ALTER TABLE oimmei_phrase_category ADD CONSTRAINT FK_334CC23EAEAB3C7C FOREIGN KEY (oimmei_phrase_id) REFERENCES oimmei_phrase (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE oimmei_phrase_category ADD CONSTRAINT FK_334CC23E12469DE2 FOREIGN KEY (category_id) REFERENCES category (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE category ALTER alexa_name DROP NOT NULL');
$this->addSql('ALTER TABLE oimmei_phrase ALTER alexa_phrase DROP NOT NULL');
$this->addSql('ALTER TABLE oimmei_phrase ALTER author DROP NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE oimmei_phrase_category');
$this->addSql('ALTER TABLE category ALTER alexa_name SET NOT NULL');
$this->addSql('ALTER TABLE oimmei_phrase ALTER alexa_phrase SET NOT NULL');
$this->addSql('ALTER TABLE oimmei_phrase ALTER author SET NOT NULL');
}
}