diff --git a/app/db/tables.ts b/app/db/tables.ts index 2b9bb82c3..12912ced0 100644 --- a/app/db/tables.ts +++ b/app/db/tables.ts @@ -644,19 +644,6 @@ export interface TournamentStage { createdAt: Generated; } -/** Tournament sub post, shown in a list of subs available for teams to pick from. */ -export interface TournamentSub { - bestWeapons: JSONColumnType; - /** 0 = no, 1 = yes, 2 = listen only */ - canVc: number; - createdAt: Generated; - message: string | null; - okWeapons: JSONColumnTypeNullable; - tournamentId: number; - userId: number; - visibility: "+1" | "+2" | "+3" | "ALL"; -} - export interface TournamentLFGLike { likerTeamId: number; targetTeamId: number; @@ -1279,7 +1266,6 @@ export interface DB { TournamentResult: TournamentResult; TournamentRound: TournamentRound; TournamentStage: TournamentStage; - TournamentSub: TournamentSub; TournamentTeam: TournamentTeam; TournamentTeamCheckIn: TournamentTeamCheckIn; TournamentTeamMember: TournamentTeamMember; diff --git a/db-test.sqlite3 b/db-test.sqlite3 index 4fb638a25..47b9859e6 100644 Binary files a/db-test.sqlite3 and b/db-test.sqlite3 differ diff --git a/e2e/seeds/db-seed-AB_RR.sqlite3 b/e2e/seeds/db-seed-AB_RR.sqlite3 index 163c3004b..b4629ab40 100644 Binary files a/e2e/seeds/db-seed-AB_RR.sqlite3 and b/e2e/seeds/db-seed-AB_RR.sqlite3 differ diff --git a/e2e/seeds/db-seed-DEFAULT.sqlite3 b/e2e/seeds/db-seed-DEFAULT.sqlite3 index 2fa89455e..e5173b07c 100644 Binary files a/e2e/seeds/db-seed-DEFAULT.sqlite3 and b/e2e/seeds/db-seed-DEFAULT.sqlite3 differ diff --git a/e2e/seeds/db-seed-FINALIZED_BRACKET.sqlite3 b/e2e/seeds/db-seed-FINALIZED_BRACKET.sqlite3 index 23b5f0b75..495d59203 100644 Binary files a/e2e/seeds/db-seed-FINALIZED_BRACKET.sqlite3 and b/e2e/seeds/db-seed-FINALIZED_BRACKET.sqlite3 differ diff --git a/e2e/seeds/db-seed-IN_SQ_MATCH.sqlite3 b/e2e/seeds/db-seed-IN_SQ_MATCH.sqlite3 index 0f2094823..b9a987e0b 100644 Binary files a/e2e/seeds/db-seed-IN_SQ_MATCH.sqlite3 and b/e2e/seeds/db-seed-IN_SQ_MATCH.sqlite3 differ diff --git a/e2e/seeds/db-seed-NO_SCRIMS.sqlite3 b/e2e/seeds/db-seed-NO_SCRIMS.sqlite3 index 028f446d0..a1e2464eb 100644 Binary files a/e2e/seeds/db-seed-NO_SCRIMS.sqlite3 and b/e2e/seeds/db-seed-NO_SCRIMS.sqlite3 differ diff --git a/e2e/seeds/db-seed-NO_SQ_GROUPS.sqlite3 b/e2e/seeds/db-seed-NO_SQ_GROUPS.sqlite3 index 48165a0f8..cbbbdaa74 100644 Binary files a/e2e/seeds/db-seed-NO_SQ_GROUPS.sqlite3 and b/e2e/seeds/db-seed-NO_SQ_GROUPS.sqlite3 differ diff --git a/e2e/seeds/db-seed-NO_TOURNAMENT_TEAMS.sqlite3 b/e2e/seeds/db-seed-NO_TOURNAMENT_TEAMS.sqlite3 index 49b2f5d57..a9c03193b 100644 Binary files a/e2e/seeds/db-seed-NO_TOURNAMENT_TEAMS.sqlite3 and b/e2e/seeds/db-seed-NO_TOURNAMENT_TEAMS.sqlite3 differ diff --git a/e2e/seeds/db-seed-NZAP_IN_TEAM.sqlite3 b/e2e/seeds/db-seed-NZAP_IN_TEAM.sqlite3 index e63278787..6468fb68b 100644 Binary files a/e2e/seeds/db-seed-NZAP_IN_TEAM.sqlite3 and b/e2e/seeds/db-seed-NZAP_IN_TEAM.sqlite3 differ diff --git a/e2e/seeds/db-seed-REG_OPEN.sqlite3 b/e2e/seeds/db-seed-REG_OPEN.sqlite3 index 0550c749f..64e8b8c94 100644 Binary files a/e2e/seeds/db-seed-REG_OPEN.sqlite3 and b/e2e/seeds/db-seed-REG_OPEN.sqlite3 differ diff --git a/e2e/seeds/db-seed-SMALL_SOS.sqlite3 b/e2e/seeds/db-seed-SMALL_SOS.sqlite3 index c68d7ff6f..69ebfbc4b 100644 Binary files a/e2e/seeds/db-seed-SMALL_SOS.sqlite3 and b/e2e/seeds/db-seed-SMALL_SOS.sqlite3 differ diff --git a/e2e/seeds/db-seed-TEAM_MAP_PREFS.sqlite3 b/e2e/seeds/db-seed-TEAM_MAP_PREFS.sqlite3 index bf9d838ad..4a38d0f09 100644 Binary files a/e2e/seeds/db-seed-TEAM_MAP_PREFS.sqlite3 and b/e2e/seeds/db-seed-TEAM_MAP_PREFS.sqlite3 differ diff --git a/migrations/164-drop-tournament-sub.js b/migrations/164-drop-tournament-sub.js new file mode 100644 index 000000000..c573af4b0 --- /dev/null +++ b/migrations/164-drop-tournament-sub.js @@ -0,0 +1,7 @@ +export function up(db) { + db.transaction(() => { + db.prepare(/* sql */ `drop table if exists "TournamentSub"`).run(); + + db.pragma("foreign_key_check"); + })(); +} diff --git a/scripts/benchmark-db/cases.ts b/scripts/benchmark-db/cases.ts index a80a02bfe..3cb73546e 100644 --- a/scripts/benchmark-db/cases.ts +++ b/scripts/benchmark-db/cases.ts @@ -674,9 +674,9 @@ export function buildCases(fx: Fixtures): { ); add( "TournamentLFGRepository.findAllSubsByTournamentId", - fx.subsTournamentId, - (tournamentId) => - TournamentLFGRepository.findAllSubsByTournamentId(tournamentId), + fx.lfgTournament, + (lfg) => + TournamentLFGRepository.findAllSubsByTournamentId(lfg.tournamentId), ); // TournamentMatchRepository diff --git a/scripts/benchmark-db/fixtures.ts b/scripts/benchmark-db/fixtures.ts index 27fd4fe7f..983db3ac7 100644 --- a/scripts/benchmark-db/fixtures.ts +++ b/scripts/benchmark-db/fixtures.ts @@ -75,7 +75,6 @@ export interface Fixtures { } | null; lfgAuthorId: number | null; lfgTournament: { tournamentId: number; teamId: number } | null; - subsTournamentId: number | null; auditTournamentId: number | null; xrank: { userId: number; @@ -154,7 +153,6 @@ export async function resolveFixtures(): Promise { heavyAssociation: await resolveHeavyAssociation(), lfgAuthorId: await resolveLfgAuthorId(), lfgTournament: await resolveLfgTournament(), - subsTournamentId: (await resolveSubsTournamentId()) ?? heavyTournamentId, auditTournamentId: (await resolveAuditTournamentId()) ?? heavyTournamentId, xrank: await resolveXRank(), heavyArtUserId: await resolveHeavyArtUserId(), @@ -934,18 +932,6 @@ async function resolveLfgTournament() { return { tournamentId: row.tournamentId, teamId: row.id }; } -async function resolveSubsTournamentId() { - const row = await db - .selectFrom("TournamentSub") - .select(({ fn }) => ["tournamentId", fn.countAll().as("count")]) - .groupBy("tournamentId") - .orderBy("count", "desc") - .limit(1) - .executeTakeFirst(); - - return row?.tournamentId ?? null; -} - async function resolveAuditTournamentId() { const row = await db .selectFrom("TournamentAuditLog")