<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* インデックスコマンド実行ログテーブル作成
*/
final class Version20260204112608 extends AbstractMigration
{
public function getDescription(): string
{
return 'インデックスコマンド実行ログテーブル(dtb_index_command_log)を作成';
}
public function up(Schema $schema): void
{
$this->addSql("
CREATE TABLE dtb_index_command_log (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
command_name VARCHAR(64) NOT NULL,
executed_at DATETIME NOT NULL,
new_products_count INT NOT NULL DEFAULT 0,
inspected_count INT NOT NULL DEFAULT 0,
status_changed_count INT NOT NULL DEFAULT 0,
error_log TEXT NULL,
status VARCHAR(16) NOT NULL DEFAULT 'success',
created_at DATETIME NOT NULL,
PRIMARY KEY (id),
INDEX idx_executed_at (executed_at),
INDEX idx_command_name (command_name),
INDEX idx_status (status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
");
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE dtb_index_command_log');
}
}