<?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 Version20221212181726 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('ALTER TABLE blog_post ADD COLUMN published BOOLEAN NOT NULL default 0');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX UNIQ_BA5AE01D989D9B62');
$this->addSql('CREATE TEMPORARY TABLE __temp__blog_post AS SELECT id, title, slug, created_at, updated_at, poster, page_title, meta_description FROM blog_post');
$this->addSql('DROP TABLE blog_post');
$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('INSERT INTO blog_post (id, title, slug, created_at, updated_at, poster, page_title, meta_description) SELECT id, title, slug, created_at, updated_at, poster, page_title, meta_description FROM __temp__blog_post');
$this->addSql('DROP TABLE __temp__blog_post');
$this->addSql('CREATE UNIQUE INDEX UNIQ_BA5AE01D989D9B62 ON blog_post (slug)');
$this->addSql('DROP INDEX IDX_CA877A44A77FBEAF');
$this->addSql('DROP INDEX IDX_CA877A442F9DC6D0');
$this->addSql('CREATE TEMPORARY TABLE __temp__blog_post_blog_tag AS SELECT blog_post_id, blog_tag_id FROM blog_post_blog_tag');
$this->addSql('DROP TABLE blog_post_blog_tag');
$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('INSERT INTO blog_post_blog_tag (blog_post_id, blog_tag_id) SELECT blog_post_id, blog_tag_id FROM __temp__blog_post_blog_tag');
$this->addSql('DROP TABLE __temp__blog_post_blog_tag');
$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');
}
}