<?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 Version20190930143203 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 live_video (`id` INT AUTO_INCREMENT NOT NULL, `product_category_id` INT DEFAULT NULL, `name` VARCHAR(255) NOT NULL, `des` VARCHAR(4000) DEFAULT NULL, `status` VARCHAR(255) NOT NULL COMMENT \'(DC2Type:live_video_status_type)\', `start_date` DATE DEFAULT NULL, `end_date` DATE DEFAULT NULL, `thumbnail` LONGBLOB DEFAULT NULL, `video_source` VARCHAR(255) DEFAULT NULL COMMENT \'(DC2Type:video_source)\', `videoId` VARCHAR(255) DEFAULT NULL, `create_user` VARCHAR(50) NOT NULL, `creation_date` DATETIME NOT NULL, `modified_user` VARCHAR(50) DEFAULT NULL, `modified_date` DATETIME DEFAULT NULL, PRIMARY KEY(`id`)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE live_video_tag (live_video_id INT NOT NULL, tag_video_id INT NOT NULL, INDEX IDX_430712F7EE9775BA (live_video_id), INDEX IDX_430712F71FF07B95 (tag_video_id), PRIMARY KEY(live_video_id, tag_video_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE live_video_attribute (`id` INT AUTO_INCREMENT NOT NULL, `key` VARCHAR(255) NOT NULL, `value` VARCHAR(255) NOT NULL, `liveVideo_id` INT NOT NULL, INDEX IDX_AF12FC0237882119 (`liveVideo_id`), PRIMARY KEY(`id`)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE live_video_document (`id` INT AUTO_INCREMENT NOT NULL, `live_video_id` INT NOT NULL, `document_id` INT NOT NULL, INDEX IDX_B55C5CC1F0BC7CF1 (`live_video_id`), INDEX IDX_B55C5CC15D9C4E11 (`document_id`), PRIMARY KEY(`id`)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE live_video_tag ADD CONSTRAINT FK_430712F7EE9775BA FOREIGN KEY (live_video_id) REFERENCES live_video (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE live_video_tag ADD CONSTRAINT FK_430712F71FF07B95 FOREIGN KEY (tag_video_id) REFERENCES tag_video (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE live_video_attribute ADD CONSTRAINT FK_AF12FC0237882119 FOREIGN KEY (`liveVideo_id`) REFERENCES live_video (`id`) ON DELETE CASCADE');
$this->addSql('ALTER TABLE live_video_document ADD CONSTRAINT FK_B55C5CC1F0BC7CF1 FOREIGN KEY (`live_video_id`) REFERENCES live_video (`id`) ON DELETE CASCADE');
$this->addSql('ALTER TABLE live_video_document ADD CONSTRAINT FK_B55C5CC15D9C4E11 FOREIGN KEY (`document_id`) REFERENCES document (`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_tag DROP FOREIGN KEY FK_430712F7EE9775BA');
$this->addSql('ALTER TABLE live_video_attribute DROP FOREIGN KEY FK_AF12FC0237882119');
$this->addSql('ALTER TABLE live_video_document DROP FOREIGN KEY FK_B55C5CC1F0BC7CF1');
$this->addSql('DROP TABLE live_video');
$this->addSql('DROP TABLE live_video_tag');
$this->addSql('DROP TABLE live_video_attribute');
$this->addSql('DROP TABLE live_video_document');
}
}