import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient({ log: ["error"] });
const rows = await prisma.$queryRaw`
  SELECT INDEX_NAME, COLUMN_NAME, SEQ_IN_INDEX, NON_UNIQUE
  FROM information_schema.STATISTICS
  WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'votes'
  ORDER BY INDEX_NAME, SEQ_IN_INDEX
`;
for (const r of rows) {
  console.log(
    `  ${r.INDEX_NAME}  col=${r.COLUMN_NAME}  seq=${r.SEQ_IN_INDEX}  unique=${r.NON_UNIQUE == 0 ? "Y" : "N"}`,
  );
}
await prisma.$disconnect();
