<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250909124525 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add CSV fields for EC2 export compatibility';
}
public function up(Schema $schema): void
{
// Add CSV fields for EC2 export compatibility
$csvFields = [
['getProductArtistNamesString', 'アーティスト名', 35],
['getProductArtistIdsString', 'アーティストID', 36],
['papc3', '修飾語(頭)', 37],
['papc4', '修飾語(後半)', 38],
['getProductSaleTypeIdsString', '商品種別ID', 39],
['getProductStatusNamesString', '商品ステータス', 40],
['getProductStatusIdsString', '商品ステータス名', 41],
['getProductCategoryIdsString', 'カテゴリID', 42],
['getProductCategoryNamesString', 'カテゴリ名', 43],
['sub_comment1', '詳細-サブコメント(1)', 44],
['sub_comment2', '詳細-サブコメント(2)', 45],
['maker_id', 'メーカーID', 46],
['Maker', 'メーカー名', 47, 'name'],
['maker_url', 'メーカーURL', 48],
['comment1', 'JAN', 49],
['comment3', '検索ワード', 50],
['note', '備考欄(SHOP専用)', 51],
['main_list_comment', '一覧-メインコメント', 52],
['main_comment', '詳細-メインコメント', 53],
['sub_title1', '詳細-サブタイトル(1)', 54],
['sub_image1', '詳細-サブ画像(1)', 55],
['sub_large_image1', '詳細-サブ拡大画像(1)', 56],
['sub_title2', '詳細-サブタイトル(2)', 57],
['sub_image2', '詳細-サブ画像(2)', 58],
['sub_large_image2', '詳細-サブ拡大画像(2)', 59],
['sub_title3', '詳細-サブタイトル(3)', 60],
['sub_comment3', '詳細-サブコメント(3)', 61],
['sub_image3', '詳細-サブ画像(3)', 62],
['sub_large_image3', '詳細-サブ拡大画像(3)', 63],
['sub_title4', '詳細-サブタイトル(4)', 64],
['sub_comment4', '詳細-サブコメント(4)', 65],
['sub_image4', '詳細-サブ画像(4)', 66],
['sub_large_image4', '詳細-サブ拡大画像(4)', 67],
['sub_title5', '詳細-サブタイトル(5)', 68],
['sub_comment5', '詳細-サブコメント(5)', 69],
['sub_image5', '詳細-サブ画像(5)', 70],
['sub_large_image5', '詳細-サブ拡大画像(5)', 71],
['papc12', '詳細ページイメージ画像URL', 72],
['papc13', '詳細ページイメージ画像ALT', 73],
['getProductTvIdsString', 'TV ID', 74],
['getProductTvNamesString', 'TV名', 75],
['getProductRelatedProduct1Id', '関連商品ID(1)', 76],
['getProductRelatedProduct1Content', '関連商品コメント(1)', 77],
['getProductRelatedProduct2Id', '関連商品ID(2)', 78],
['getProductRelatedProduct2Content', '関連商品コメント(2)', 79],
['getProductRelatedProduct3Id', '関連商品ID(3)', 80],
['getProductRelatedProduct3Content', '関連商品コメント(3)', 81],
['getProductRelatedProduct4Id', '関連商品ID(4)', 82],
['getProductRelatedProduct4Content', '関連商品コメント(4)', 83],
['getProductRelatedProduct5Id', '関連商品ID(5)', 84],
['getProductRelatedProduct5Content', '関連商品コメント(5)', 85],
['getProductRelatedProduct6Id', '関連商品ID(6)', 86],
['getProductRelatedProduct6Content', '関連商品コメント(6)', 87],
['getProductRelatedProduct7Id', '関連商品ID(7)', 88],
['getProductRelatedProduct7Content', '関連商品コメント(7)', 89],
['getProductRelatedProduct8Id', '関連商品ID(8)', 90],
['getProductRelatedProduct8Content', '関連商品コメント(8)', 91],
['getProductRelatedProduct9Id', '関連商品ID(9)', 92],
['getProductRelatedProduct9Content', '関連商品コメント(9)', 93],
['getProductRelatedProduct10Id', '関連商品ID(10)', 94],
['getProductRelatedProduct10Content', '関連商品コメント(10)', 95],
['getProductRelatedProduct11Id', '関連商品ID(11)', 96],
['getProductRelatedProduct11Content', '関連商品コメント(11)', 97],
['getProductRelatedProduct12Id', '関連商品ID(12)', 98],
['getProductRelatedProduct12Content', '関連商品コメント(12)', 99],
['getProductRelatedProduct13Id', '関連商品ID(13)', 100],
['getProductRelatedProduct13Content', '関連商品コメント(13)', 101],
['getProductRelatedProduct14Id', '関連商品ID(14)', 102],
['getProductRelatedProduct14Content', '関連商品コメント(14)', 103],
['getProductRelatedProduct15Id', '関連商品ID(15)', 104],
['getProductRelatedProduct15Content', '関連商品コメント(15)', 105],
['getProductRelatedProduct16Id', '関連商品ID(16)', 106],
['getProductRelatedProduct16Content', '関連商品コメント(16)', 107],
];
foreach ($csvFields as $field) {
$fieldName = $field[0];
$dispName = $field[1];
$sortNo = $field[2];
$referenceFieldName = isset($field[3]) ? $field[3] : null;
if ($referenceFieldName) {
$this->addSql("INSERT INTO `dtb_csv` (`csv_type_id`, `creator_id`, `entity_name`, `field_name`, `disp_name`, `sort_no`, `enabled`, `discriminator_type`, `reference_field_name`, `create_date`, `update_date`) VALUES ('1', '1', 'Eccube\\\\\\\\Entity\\\\\\\\Product', '{$fieldName}', '{$dispName}', '{$sortNo}', '0', 'csv', '{$referenceFieldName}', NOW(), NOW())");
} else {
$this->addSql("INSERT INTO `dtb_csv` (`csv_type_id`, `creator_id`, `entity_name`, `field_name`, `disp_name`, `sort_no`, `enabled`, `discriminator_type`, `create_date`, `update_date`) VALUES ('1', '1', 'Eccube\\\\\\\\Entity\\\\\\\\Product', '{$fieldName}', '{$dispName}', '{$sortNo}', '0', 'csv', NOW(), NOW())");
}
}
}
public function down(Schema $schema): void
{
// Remove CSV fields for EC2 export compatibility
$csvFields = [
'getProductArtistNamesString',
'getProductArtistIdsString',
'papc3',
'papc4',
'getProductSaleTypeIdsString',
'getProductStatusNamesString',
'getProductStatusIdsString',
'getProductCategoryIdsString',
'getProductCategoryNamesString',
'sub_comment1',
'sub_comment2',
'maker_id',
'Maker',
'maker_url',
'comment1',
'comment3',
'note',
'main_list_comment',
'main_comment',
'sub_title1',
'sub_image1',
'sub_large_image1',
'sub_title2',
'sub_image2',
'sub_large_image2',
'sub_title3',
'sub_comment3',
'sub_image3',
'sub_large_image3',
'sub_title4',
'sub_comment4',
'sub_image4',
'sub_large_image4',
'sub_title5',
'sub_comment5',
'sub_image5',
'sub_large_image5',
'papc12',
'papc13',
'getProductTvIdsString',
'getProductTvNamesString',
'getProductRelatedProduct1Id',
'getProductRelatedProduct1Content',
'getProductRelatedProduct2Id',
'getProductRelatedProduct2Content',
'getProductRelatedProduct3Id',
'getProductRelatedProduct3Content',
'getProductRelatedProduct4Id',
'getProductRelatedProduct4Content',
'getProductRelatedProduct5Id',
'getProductRelatedProduct5Content',
'getProductRelatedProduct6Id',
'getProductRelatedProduct6Content',
'getProductRelatedProduct7Id',
'getProductRelatedProduct7Content',
'getProductRelatedProduct8Id',
'getProductRelatedProduct8Content',
'getProductRelatedProduct9Id',
'getProductRelatedProduct9Content',
'getProductRelatedProduct10Id',
'getProductRelatedProduct10Content',
'getProductRelatedProduct11Id',
'getProductRelatedProduct11Content',
'getProductRelatedProduct12Id',
'getProductRelatedProduct12Content',
'getProductRelatedProduct13Id',
'getProductRelatedProduct13Content',
'getProductRelatedProduct14Id',
'getProductRelatedProduct14Content',
'getProductRelatedProduct15Id',
'getProductRelatedProduct15Content',
'getProductRelatedProduct16Id',
'getProductRelatedProduct16Content',
];
foreach ($csvFields as $fieldName) {
$this->addSql("DELETE FROM `dtb_csv` WHERE `csv_type_id` = 1 AND `field_name` = '{$fieldName}' AND `entity_name` = 'Eccube\\\\\\\\Entity\\\\\\\\Product'");
}
}
}