<?php

declare(strict_types=1);

/**
 * M10 performance indices for pages listing.
 *
 * @return callable(PDO, string): void
 */
return static function (\PDO $pdo, string $prefix): void {
    if (!preg_match('/^[a-zA-Z0-9_]+$/', $prefix)) {
        throw new InvalidArgumentException('Invalid table prefix');
    }
    $t = '`' . $prefix . 'gsc_daily_page`';
    try { $pdo->exec("ALTER TABLE {$t} ADD KEY `idx_prop_date_page` (`property_id`, `date`, `page`(191))"); } catch (\Throwable) {}
    try { $pdo->exec("ALTER TABLE {$t} ADD KEY `idx_prop_page` (`property_id`, `page`(191))"); } catch (\Throwable) {}
};

