Add fix map pools script

This commit is contained in:
Kalle
2023-04-24 23:58:38 +03:00
parent 1a78d1a162
commit ff0d6cb4d0
2 changed files with 17 additions and 0 deletions

16
scripts/fix-map-pools.ts Normal file
View File

@@ -0,0 +1,16 @@
/* eslint-disable no-console */
import "dotenv/config";
import { sql } from "~/db/sql";
const faultyTournamentTeamIds = sql
.prepare(
"select tournamentTeamId from mappoolmap where tournamentteamid is not null and mode != 'SZ' group by tournamentteamid"
)
.all()
.map((row) => row.tournamentTeamId);
for (const id of faultyTournamentTeamIds) {
sql.prepare("delete from mappoolmap where tournamentteamid = ?").run(id);
}
console.log(`Nuked the following: ${faultyTournamentTeamIds.join(", ")}`);