feat: exam actions and data safety fixes

This commit is contained in:
SpecialX
2025-12-30 17:48:22 +08:00
parent e7c902e8e1
commit f7ff018490
27 changed files with 896 additions and 194 deletions

View File

@@ -16,8 +16,18 @@ async function reset() {
`)
// Drop each table
for (const row of (tables[0] as unknown as any[])) {
const tableName = row.TABLE_NAME || row.table_name
const rows = (tables as unknown as [unknown])[0]
if (!Array.isArray(rows)) return
for (const row of rows) {
const record = row as Record<string, unknown>
const tableName =
typeof record.TABLE_NAME === "string"
? record.TABLE_NAME
: typeof record.table_name === "string"
? record.table_name
: null
if (!tableName) continue
console.log(`Dropping table: ${tableName}`)
await db.execute(sql.raw(`DROP TABLE IF EXISTS \`${tableName}\`;`))
}