<?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 Version20190926142643 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($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE media_tag_video (media_id INT NOT NULL, tag_video_id INT NOT NULL, INDEX IDX_7B4B70A4EA9FDD75 (media_id), INDEX IDX_7B4B70A41FF07B95 (tag_video_id), PRIMARY KEY(media_id, tag_video_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE tag_video (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_5E2BC32A5E237E06 (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE media_tag_video ADD CONSTRAINT FK_7B4B70A4EA9FDD75 FOREIGN KEY (media_id) REFERENCES media (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE media_tag_video ADD CONSTRAINT FK_7B4B70A41FF07B95 FOREIGN KEY (tag_video_id) REFERENCES tag_video (id) ON DELETE CASCADE');
}
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 live_video_document DROP FOREIGN KEY FK_B55C5CC1F0BC7CF1');
$this->addSql('ALTER TABLE media_tag_video DROP FOREIGN KEY FK_7B4B70A41FF07B95');
$this->addSql('DROP TABLE media_tag_video');
$this->addSql('DROP TABLE tag_video');
}
}