migrations/Version20220124114530.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20220124114530 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $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))');
  19.         $this->addSql('CREATE INDEX IDX_334CC23EAEAB3C7C ON oimmei_phrase_category (oimmei_phrase_id)');
  20.         $this->addSql('CREATE INDEX IDX_334CC23E12469DE2 ON oimmei_phrase_category (category_id)');
  21.         $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');
  22.         $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');
  23.         $this->addSql('ALTER TABLE category ALTER alexa_name DROP NOT NULL');
  24.         $this->addSql('ALTER TABLE oimmei_phrase ALTER alexa_phrase DROP NOT NULL');
  25.         $this->addSql('ALTER TABLE oimmei_phrase ALTER author DROP NOT NULL');
  26.     }
  27.     public function down(Schema $schema): void
  28.     {
  29.         // this down() migration is auto-generated, please modify it to your needs
  30.         $this->addSql('DROP TABLE oimmei_phrase_category');
  31.         $this->addSql('ALTER TABLE category ALTER alexa_name SET NOT NULL');
  32.         $this->addSql('ALTER TABLE oimmei_phrase ALTER alexa_phrase SET NOT NULL');
  33.         $this->addSql('ALTER TABLE oimmei_phrase ALTER author SET NOT NULL');
  34.     }
  35. }