<?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 Version20201007223759 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->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE project_comment ADD card_id INT DEFAULT NULL, ADD type ENUM(\'comment\', \'card\', \'item\') DEFAULT NULL COMMENT \'(DC2Type:ProjectCommentType)\', CHANGE body body LONGTEXT DEFAULT NULL');
$this->addSql('ALTER TABLE project_comment ADD CONSTRAINT FK_26A5E094ACC9A20 FOREIGN KEY (card_id) REFERENCES project_card (id) ON DELETE SET NULL');
$this->addSql('CREATE INDEX IDX_26A5E094ACC9A20 ON project_comment (card_id)');
$this->addSql('UPDATE project_comment SET type = \'comment\'');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE project_comment DROP FOREIGN KEY FK_26A5E094ACC9A20');
$this->addSql('DROP INDEX IDX_26A5E094ACC9A20 ON project_comment');
$this->addSql('ALTER TABLE project_comment DROP card_id, DROP type, CHANGE body body LONGTEXT NOT NULL COLLATE utf8mb4_unicode_ci');
}
}