app/DoctrineMigrations/Version20210316120000.php line 1

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace DoctrineMigrations;
  3. use Doctrine\DBAL\Schema\Schema;
  4. use Doctrine\Migrations\AbstractMigration;
  5. /**
  6.  * Auto-generated Migration: Please modify to your needs!
  7.  */
  8. final class Version20210316120000 extends AbstractMigration
  9. {
  10.     public function up(Schema $schema): void
  11.     {
  12. /*
  13.         // データ存在チェック
  14.         $count = $this->connection->fetchOne("SELECT COUNT(*) FROM dtb_block WHERE block_name = 'カレンダー'");
  15.         if ($count > 0) {
  16.             return;
  17.         }
  18.         // idを取得する
  19.         $id = $this->connection->fetchOne('SELECT MAX(id) FROM dtb_block');
  20.         $id++;
  21.         $this->addSql("INSERT INTO dtb_block (id, block_name, file_name, use_controller, deletable, create_date, update_date, device_type_id, discriminator_type) VALUES ($id, 'カレンダー', 'calendar', true, false, '2021-03-16 12:00:00', '2021-03-16 12:00:00', 10, 'block')");
  22. */
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         // this down() migration is auto-generated, please modify it to your needs
  27.     }
  28. }