app/DoctrineMigrations/Version20240409084628.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 Version20240409084628 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $exists $this->connection->fetchOne("
  19.             SELECT count(*)
  20.             FROM dtb_temperature_control
  21.             WHERE name IN (
  22.                 '常温商品', '冷蔵商品', '冷凍配送(冷蔵配送可)', '冷凍配送(冷凍配送のみ)'
  23.             )
  24.         ");
  25.         if ($exists == 0) {
  26.             $this->addSql("
  27.                 INSERT INTO dtb_temperature_control (
  28.                     id, name, sort_no, discriminator_type
  29.                 ) VALUES
  30.                     (null, '常温商品', 0, 'temperaturecontrol'),
  31.                     (null, '冷蔵商品', 1, 'temperaturecontrol'),
  32.                     (null, '冷凍配送(冷蔵配送可)', 2, 'temperaturecontrol'),
  33.                     (null, '冷凍配送(冷凍配送のみ)', 3, 'temperaturecontrol')
  34.                 ;");
  35.         }
  36.     }
  37.     public function down(Schema $schema): void
  38.     {
  39.         // this down() migration is auto-generated, please modify it to your needs
  40.     }
  41. }