app/DoctrineMigrations/Version24121700_AddProductExCartCsv.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. final class Version24121700_AddProductExCartCsv extends AbstractMigration
  7. {
  8.     public function up(Schema $schema): void
  9.     {
  10.         $this->addSql("
  11.             INSERT INTO dtb_csv (
  12.                 csv_type_id,
  13.                 entity_name,
  14.                 field_name,
  15.                 reference_field_name,
  16.                 disp_name,
  17.                 sort_no,
  18.                 enabled,
  19.                 create_date,
  20.                 update_date,
  21.                 discriminator_type
  22.             )
  23.             VALUES
  24.             -- 売価非表示コメント
  25.             (
  26.                 1,
  27.                 'Customize\\Entity\\ProductEx',
  28.                 'Product',
  29.                 'info_comment2',
  30.                 '売価非表示コメント',
  31.                 34,
  32.                 1,
  33.                 CURRENT_TIMESTAMP,
  34.                 CURRENT_TIMESTAMP,
  35.                 'csv'
  36.             ),
  37.             -- 売価非表示フラグ
  38.             (
  39.                 1,
  40.                 'Customize\\Entity\\ProductEx',
  41.                 'Product',
  42.                 'ask_price',
  43.                 '売価非表示フラグ',
  44.                 35,
  45.                 1,
  46.                 CURRENT_TIMESTAMP,
  47.                 CURRENT_TIMESTAMP,
  48.                 'csv'
  49.             ),
  50.             -- カートボタン非表示フラグ
  51.             (
  52.                 1,
  53.                 'Customize\\Entity\\ProductEx',
  54.                 'Product',
  55.                 'disable_cart',
  56.                 'カートボタン非表示フラグ',
  57.                 36,
  58.                 1,
  59.                 CURRENT_TIMESTAMP,
  60.                 CURRENT_TIMESTAMP,
  61.                 'csv'
  62.             )
  63.         ");
  64.     }
  65.     public function down(Schema $schema): void
  66.     {
  67.         $this->addSql("
  68.             DELETE FROM dtb_csv 
  69.             WHERE entity_name = 'Customize\\Entity\\ProductEx'
  70.             AND field_name = 'Product'
  71.             AND reference_field_name IN ('info_comment2', 'ask_price', 'disable_cart')
  72.             AND csv_type_id = 1
  73.         ");
  74.     }
  75. }