<?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 Version20191003224411 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 favorite ADD project_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE favorite ADD CONSTRAINT FK_68C58ED9166D1F9C FOREIGN KEY (project_id) REFERENCES project (id) ON DELETE CASCADE');
$this->addSql('CREATE INDEX IDX_68C58ED9166D1F9C ON favorite (project_id)');
$this->addSql('ALTER TABLE favorite CHANGE type type ENUM(\'customer\',\'lead\',\'event\',\'project\',\'feed\',\'issue\',\'report\') NOT NULL COMMENT \'(DC2Type:FavoriteSectionType)\'');
}
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 favorite CHANGE type type ENUM(\'customer\',\'lead\',\'event\',\'issue\',\'feed\',\'report\') NOT NULL COMMENT \'(DC2Type:FavoriteSectionType)\'');
$this->addSql('ALTER TABLE favorite DROP FOREIGN KEY FK_68C58ED9166D1F9C');
$this->addSql('DROP INDEX IDX_68C58ED9166D1F9C ON favorite');
$this->addSql('ALTER TABLE favorite DROP project_id');
}
}