Files
edu/bbs/_tmp/_inspect_learning_indexes.php

21 lines
589 B
PHP

<?php
declare(strict_types=1);
require __DIR__ . '/../db_conn.php';
$pdo = db_conn();
echo "--- SHOW CREATE TABLE ---\n";
$row = $pdo->query('SHOW CREATE TABLE edu_learning_histories')->fetch(PDO::FETCH_ASSOC);
echo ($row['Create Table'] ?? 'N/A') . "\n\n";
echo "--- INDEXES ---\n";
$stmt = $pdo->query('SHOW INDEX FROM edu_learning_histories');
foreach ($stmt as $r) {
echo ($r['Key_name'] ?? ''), "\t",
($r['Seq_in_index'] ?? ''), "\t",
($r['Column_name'] ?? ''), "\t",
((int)($r['Non_unique'] ?? 1) === 0 ? 'UNIQUE' : 'NON_UNIQUE'),
"\n";
}