<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* 商品検索インデックス状態管理テーブル作成
*/
final class Version20260123144511 extends AbstractMigration
{
public function getDescription(): string
{
return '商品検索インデックス状態管理テーブル(dtb_product_search_index)を作成';
}
public function up(Schema $schema): void
{
$this->addSql("
CREATE TABLE dtb_product_search_index (
product_id INT UNSIGNED NOT NULL,
url VARCHAR(255) NOT NULL,
status ENUM('indexed','pending','hold','noindex') NOT NULL DEFAULT 'pending',
status_changed_at DATETIME NOT NULL,
last_checked_at DATETIME NULL,
source VARCHAR(32) NULL,
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
PRIMARY KEY (product_id),
INDEX idx_status (status),
INDEX idx_status_changed_at (status_changed_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
");
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE dtb_product_search_index');
}
}