migrations/Version20180430145708.php line 1

Open in your IDE?
  1. <?php
  2. namespace DoctrineMigrations;
  3. use Doctrine\Migrations\AbstractMigration;
  4. use Doctrine\DBAL\Schema\Schema;
  5. /**
  6. * Auto-generated Migration: Please modify to your needs!
  7. */
  8. class Version20180430145708 extends AbstractMigration
  9. {
  10. /**
  11. * @param Schema $schema
  12. */
  13. public function up(Schema $schema) : void
  14. {
  15. // this up() migration is auto-generated, please modify it to your needs
  16. $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
  17. $this->addSql('DROP TABLE lnk_artikel_rubrik');
  18. $this->addSql('ALTER TABLE artikel ADD rubrik_ids LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json_array)\'');
  19. }
  20. /**
  21. * @param Schema $schema
  22. */
  23. public function down(Schema $schema) : void
  24. {
  25. // this down() migration is auto-generated, please modify it to your needs
  26. $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
  27. $this->addSql('CREATE TABLE lnk_artikel_rubrik (artikel_id CHAR(36) NOT NULL COLLATE utf8_unicode_ci COMMENT \'(DC2Type:entityId)\', rubrik_id CHAR(36) NOT NULL COLLATE utf8_unicode_ci COMMENT \'(DC2Type:entityId)\', INDEX IDX_623BDA87EEDF290A (artikel_id), INDEX IDX_623BDA87672AE813 (rubrik_id), PRIMARY KEY(artikel_id, rubrik_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
  28. $this->addSql('ALTER TABLE lnk_artikel_rubrik ADD CONSTRAINT FK_623BDA87672AE813 FOREIGN KEY (rubrik_id) REFERENCES rubrik (id)');
  29. $this->addSql('ALTER TABLE lnk_artikel_rubrik ADD CONSTRAINT FK_623BDA87EEDF290A FOREIGN KEY (artikel_id) REFERENCES artikel (id)');
  30. $this->addSql('ALTER TABLE artikel DROP rubrik_ids');
  31. }
  32. }