<?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 Version20221212160850 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 blog_post (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, title VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL --(DC2Type:datetime_immutable)
, updated_at DATETIME DEFAULT NULL --(DC2Type:datetime_immutable)
, poster VARCHAR(255) DEFAULT NULL, page_title VARCHAR(255) DEFAULT \'\' NOT NULL, meta_description VARCHAR(255) DEFAULT \'\' NOT NULL)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_BA5AE01D989D9B62 ON blog_post (slug)');
$this->addSql('CREATE TABLE blog_tag (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_6EC3989989D9B62 ON blog_tag (slug)');
$this->addSql('DROP INDEX IDX_ECBAF226AFC2B591');
$this->addSql('CREATE TEMPORARY TABLE __temp__module_attachment AS SELECT id, module_id, updated_at, created_at, image_name, image_original_name, image_mime_type, image_size, image_dimensions FROM module_attachment');
$this->addSql('DROP TABLE module_attachment');
$this->addSql('CREATE TABLE module_attachment (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, module_id INTEGER DEFAULT NULL, updated_at DATETIME DEFAULT NULL, created_at DATETIME NOT NULL --(DC2Type:datetime_immutable)
, image_name VARCHAR(255) DEFAULT NULL COLLATE BINARY, image_original_name VARCHAR(255) DEFAULT NULL COLLATE BINARY, image_mime_type VARCHAR(255) DEFAULT NULL COLLATE BINARY, image_size INTEGER DEFAULT NULL, image_dimensions CLOB DEFAULT NULL COLLATE BINARY --(DC2Type:simple_array)
, CONSTRAINT FK_ECBAF226AFC2B591 FOREIGN KEY (module_id) REFERENCES module_page (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO module_attachment (id, module_id, updated_at, created_at, image_name, image_original_name, image_mime_type, image_size, image_dimensions) SELECT id, module_id, updated_at, created_at, image_name, image_original_name, image_mime_type, image_size, image_dimensions FROM __temp__module_attachment');
$this->addSql('DROP TABLE __temp__module_attachment');
$this->addSql('CREATE INDEX IDX_ECBAF226AFC2B591 ON module_attachment (module_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE blog_post');
$this->addSql('DROP TABLE blog_tag');
$this->addSql('DROP INDEX IDX_ECBAF226AFC2B591');
$this->addSql('CREATE TEMPORARY TABLE __temp__module_attachment AS SELECT id, module_id, updated_at, created_at, image_name, image_original_name, image_mime_type, image_size, image_dimensions FROM module_attachment');
$this->addSql('DROP TABLE module_attachment');
$this->addSql('CREATE TABLE module_attachment (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, module_id INTEGER DEFAULT NULL, updated_at DATETIME DEFAULT NULL, created_at DATETIME NOT NULL --(DC2Type:datetime_immutable)
, image_name VARCHAR(255) DEFAULT NULL, image_original_name VARCHAR(255) DEFAULT NULL, image_mime_type VARCHAR(255) DEFAULT NULL, image_size INTEGER DEFAULT NULL, image_dimensions CLOB DEFAULT NULL --(DC2Type:simple_array)
)');
$this->addSql('INSERT INTO module_attachment (id, module_id, updated_at, created_at, image_name, image_original_name, image_mime_type, image_size, image_dimensions) SELECT id, module_id, updated_at, created_at, image_name, image_original_name, image_mime_type, image_size, image_dimensions FROM __temp__module_attachment');
$this->addSql('DROP TABLE __temp__module_attachment');
$this->addSql('CREATE INDEX IDX_ECBAF226AFC2B591 ON module_attachment (module_id)');
}
}