migrations/Version20230830150006.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 Version20230830150006 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         $this->addSql('alter table blog_post add meta_keywords TEXT default NULL');
  18.     }
  19.     public function down(Schema $schema): void
  20.     {
  21.        $this->addSql("create table blog_post_dg_tmp
  22.         (
  23.             id                INTEGER                 not null
  24.                 primary key autoincrement,
  25.             title             VARCHAR(255)            not null,
  26.             slug              VARCHAR(255)            not null,
  27.             created_at        DATETIME                not null,
  28.             updated_at        DATETIME     default NULL,
  29.             poster            VARCHAR(255) default NULL,
  30.             page_title        VARCHAR(255) default '' not null,
  31.             meta_description  VARCHAR(255) default '' not null,
  32.             published         BOOLEAN                 not null,
  33.             description       CLOB         default NULL,
  34.             short_description CLOB         default NULL,
  35.             button_text       VARCHAR(255) default NULL,
  36.             button_link       VARCHAR(255) default NULL
  37.         )");
  38.         $this->addSql("insert into blog_post_dg_tmp(id, title, slug, created_at, updated_at, poster, page_title, meta_description, published, description, short_description, button_text, button_link)
  39.                 select id, title, slug, created_at, updated_at, poster, page_title, meta_description, published, description, short_description, button_text, button_link
  40.                 from blog_post
  41.        ");
  42.         $this->addSql("drop table blog_post");
  43.         $this->addSql("alter table blog_post_dg_tmp rename to blog_post");
  44.         $this->addSql("create unique index UNIQ_BA5AE01D989D9B62  on blog_post (slug)");
  45.     }
  46. }