<?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 Version20221205125515 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->addSql('CREATE TABLE cms_media_category (id INT AUTO_INCREMENT NOT NULL, deleted_at DATETIME DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, name VARCHAR(64) NOT NULL, enable TINYINT(1) NOT NULL, sort INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE cms_media_child (id INT AUTO_INCREMENT NOT NULL, entry_id INT NOT NULL, deleted_at DATETIME DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, sort INT NOT NULL, headline VARCHAR(128) DEFAULT NULL, image VARCHAR(128) DEFAULT NULL, image_width INT DEFAULT NULL, image_height INT DEFAULT NULL, content LONGTEXT DEFAULT NULL, youtube_id VARCHAR(32) DEFAULT NULL, INDEX IDX_A04B274CBA364942 (entry_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE cms_media_entry (id INT AUTO_INCREMENT NOT NULL, category_id INT NOT NULL, deleted_at DATETIME DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, entry_date DATE NOT NULL, title VARCHAR(255) NOT NULL, enable TINYINT(1) NOT NULL, content LONGTEXT DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, main_image VARCHAR(128) DEFAULT NULL, main_image_width INT DEFAULT NULL, main_image_height INT DEFAULT NULL, thumbnail VARCHAR(128) DEFAULT NULL, link_url VARCHAR(255) DEFAULT NULL, link_new_tab TINYINT(1) NOT NULL, publish_date DATETIME DEFAULT NULL, close_date DATETIME DEFAULT NULL, INDEX IDX_A9D9EE1512469DE2 (category_id), INDEX IDX_A9D9EE15EBC4F69 (entry_date), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE cms_media_child ADD CONSTRAINT FK_A04B274CBA364942 FOREIGN KEY (entry_id) REFERENCES cms_media_entry (id)');
$this->addSql('ALTER TABLE cms_media_entry ADD CONSTRAINT FK_A9D9EE1512469DE2 FOREIGN KEY (category_id) REFERENCES cms_media_category (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE cms_media_child DROP FOREIGN KEY FK_A04B274CBA364942');
$this->addSql('ALTER TABLE cms_media_entry DROP FOREIGN KEY FK_A9D9EE1512469DE2');
$this->addSql('DROP TABLE cms_media_category');
$this->addSql('DROP TABLE cms_media_child');
$this->addSql('DROP TABLE cms_media_entry');
}
}