完成品

This commit is contained in:
2025-09-19 02:58:43 +08:00
parent ffa1e45f63
commit b5e8cce2f3
10 changed files with 926 additions and 16 deletions

34
scripts/clear-database.js Normal file
View File

@@ -0,0 +1,34 @@
const mysql = require('mysql2/promise');
async function clearDatabase() {
const connection = await mysql.createConnection({
host: 'mysql.theaken.com',
port: 33306,
user: 'AI_Platform',
password: 'Aa123456',
database: 'db_AI_Platform'
});
console.log('🗑️ 清空資料庫...');
// 清空所有表(按依賴順序)
const tables = [
'app_judge_scores',
'competition_apps',
'competition_judges',
'apps',
'judges',
'competitions',
'users'
];
for (const table of tables) {
await connection.execute(`DELETE FROM ${table}`);
console.log(`✅ 清空了 ${table}`);
}
await connection.end();
console.log('🎉 資料庫清空完成!');
}
clearDatabase().catch(console.error);