migrations/Version20190930143203.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20190930143203 extends AbstractMigration
  10. {
  11.     public function getDescription() : string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema) : void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  19.         $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');
  20.         $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');
  21.         $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');
  22.         $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');
  23.         $this->addSql('ALTER TABLE live_video_tag ADD CONSTRAINT FK_430712F7EE9775BA FOREIGN KEY (live_video_id) REFERENCES live_video (id) ON DELETE CASCADE');
  24.         $this->addSql('ALTER TABLE live_video_tag ADD CONSTRAINT FK_430712F71FF07B95 FOREIGN KEY (tag_video_id) REFERENCES tag_video (id) ON DELETE CASCADE');
  25.         $this->addSql('ALTER TABLE live_video_attribute ADD CONSTRAINT FK_AF12FC0237882119 FOREIGN KEY (`liveVideo_id`) REFERENCES live_video (`id`) ON DELETE CASCADE');
  26.         $this->addSql('ALTER TABLE live_video_document ADD CONSTRAINT FK_B55C5CC1F0BC7CF1 FOREIGN KEY (`live_video_id`) REFERENCES live_video (`id`) ON DELETE CASCADE');
  27.         $this->addSql('ALTER TABLE live_video_document ADD CONSTRAINT FK_B55C5CC15D9C4E11 FOREIGN KEY (`document_id`) REFERENCES document (`id`) ON DELETE CASCADE');
  28.     }
  29.     public function down(Schema $schema) : void
  30.     {
  31.         // this down() migration is auto-generated, please modify it to your needs
  32.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  33.         $this->addSql('ALTER TABLE live_video_tag DROP FOREIGN KEY FK_430712F7EE9775BA');
  34.         $this->addSql('ALTER TABLE live_video_attribute DROP FOREIGN KEY FK_AF12FC0237882119');
  35.         $this->addSql('ALTER TABLE live_video_document DROP FOREIGN KEY FK_B55C5CC1F0BC7CF1');
  36.         $this->addSql('DROP TABLE live_video');
  37.         $this->addSql('DROP TABLE live_video_tag');
  38.         $this->addSql('DROP TABLE live_video_attribute');
  39.         $this->addSql('DROP TABLE live_video_document');       
  40.     }
  41. }