migrations/Version20230529081305.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 Version20230529081305 extends AbstractMigration
  10. {
  11.     public function up(Schema $schema): void
  12.     {
  13.         $this->addSql('alter table blog_content add video_link TEXT default NULL');
  14.     }
  15.     public function down(Schema $schema): void
  16.     {
  17.         $this->addSql('create table blog_content_dg_tmp
  18.         (
  19.             id                  INTEGER      not null
  20.                 primary key autoincrement,
  21.             post_id             INTEGER      not null,
  22.             title               VARCHAR(255) not null,
  23.             text                CLOB         not null,
  24.             updated_at          DATETIME     default NULL,
  25.             created_at          DATETIME     not null,
  26.             image_name          VARCHAR(255) default NULL,
  27.             image_original_name VARCHAR(255) default NULL,
  28.             image_mime_type     VARCHAR(255) default NULL,
  29.             image_size          INTEGER      default NULL,
  30.             image_dimensions    CLOB         default NULL
  31.         )');
  32.         $this->addSql('insert into blog_content_dg_tmp(id, post_id, title, text, updated_at, created_at, image_name, image_original_name,
  33.                                 image_mime_type, image_size, image_dimensions)
  34.             select id,
  35.                    post_id,
  36.                    title,
  37.                    text,
  38.                    updated_at,
  39.                    created_at,
  40.                    image_name,
  41.                    image_original_name,
  42.                    image_mime_type,
  43.                    image_size,
  44.                    image_dimensions
  45.             from blog_content');
  46.         $this->addSql('drop table blog_content');
  47.         $this->addSql('alter table blog_content_dg_tmp rename to blog_content');
  48.         $this->addSql('create index IDX_12338D2A4B89032C on blog_content (post_id)');
  49.     }
  50. }