migrations/Version20190403135327.php line 1

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace DoctrineMigrations;
  3. use AppBundle\Entity\Artikel\ArtikelTyp;
  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 Version20190403135327 extends AbstractMigration
  10. {
  11. public function up(Schema $schema) : void
  12. {
  13. // this up() migration is auto-generated, please modify it to your needs
  14. $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
  15. $this->addSql('ALTER TABLE artikel ADD typ_id VARCHAR(16) NOT NULL');
  16. // alle auf FREE setzen
  17. $this->addSql("UPDATE artikel SET typ_id ='". ArtikelTyp::ID_AT_1 ."'");
  18. // alle welche contentHTML Inhalt haben auf FREE+
  19. $this->addSql("UPDATE artikel SET typ_id ='". ArtikelTyp::ID_AT_2 ."' WHERE LENGTH(contentHtml) > 0");
  20. }
  21. public function down(Schema $schema) : void
  22. {
  23. // this down() migration is auto-generated, please modify it to your needs
  24. $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
  25. $this->addSql('ALTER TABLE artikel DROP typ_id');
  26. }
  27. }