<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* サイトマップ統計情報スナップショットテーブル作成
*/
final class Version20260207212323 extends AbstractMigration
{
public function getDescription(): string
{
return 'サイトマップ統計情報スナップショットテーブル(dtb_sitemap_statistics_snapshot)を作成';
}
public function up(Schema $schema): void
{
$this->addSql("
CREATE TABLE dtb_sitemap_statistics_snapshot (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
snapshot_date DATE NOT NULL,
total INT NOT NULL DEFAULT 0,
indexed INT NOT NULL DEFAULT 0,
pending INT NOT NULL DEFAULT 0,
hold INT NOT NULL DEFAULT 0,
noindex INT NOT NULL DEFAULT 0,
created_at DATETIME NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY unique_snapshot_date (snapshot_date),
INDEX idx_snapshot_date (snapshot_date)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
");
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE dtb_sitemap_statistics_snapshot');
}
}