<?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 Version20221212164555 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_blog_tag (blog_post_id INTEGER NOT NULL, blog_tag_id INTEGER NOT NULL, PRIMARY KEY(blog_post_id, blog_tag_id))');
$this->addSql('CREATE INDEX IDX_CA877A44A77FBEAF ON blog_post_blog_tag (blog_post_id)');
$this->addSql('CREATE INDEX IDX_CA877A442F9DC6D0 ON blog_post_blog_tag (blog_tag_id)');
$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_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)');
}
}