<?php

declare(strict_types=1);

/**
 * M9 performance indices for keywords 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_query`';
    try { $pdo->exec("ALTER TABLE {$t} ADD KEY `idx_prop_date_query` (`property_id`, `date`, `query`(191))"); } catch (\Throwable) {}
    try { $pdo->exec("ALTER TABLE {$t} ADD KEY `idx_prop_query` (`property_id`, `query`(191))"); } catch (\Throwable) {}
};

