<?php declare(strict_types=1);
namespace DoctrineMigrations;
use AppBundle\Entity\Artikel\ArtikelTyp;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20190403135327 extends AbstractMigration
{
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE artikel ADD typ_id VARCHAR(16) NOT NULL');
// alle auf FREE setzen
$this->addSql("UPDATE artikel SET typ_id ='". ArtikelTyp::ID_AT_1 ."'");
// alle welche contentHTML Inhalt haben auf FREE+
$this->addSql("UPDATE artikel SET typ_id ='". ArtikelTyp::ID_AT_2 ."' WHERE LENGTH(contentHtml) > 0");
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE artikel DROP typ_id');
}
}