mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-09 04:02:40 -05:00
* Got something going * Style overwrites * width != height * More playing with lines * Migrations * Start bracket initial * Unhardcode stage generation params * Link to match page * Matches page initial * Support directly adding seed to map list generator * Add docs * Maps in matches page * Add invariant about tie breaker map pool * Fix PICNIC lacking tie breaker maps * Only link in bracket when tournament has started * Styled tournament roster inputs * Prefer IGN in tournament match page * ModeProgressIndicator * Some conditional rendering * Match action initial + better error display * Persist bestOf in DB * Resolve best of ahead of time * Move brackets-manager to core * Score reporting works * Clear winner on score report * ModeProgressIndicator: highlight winners * Fix inconsistent input * Better text when submitting match * mapCountPlayedInSetWithCertainty that works * UNDO_REPORT_SCORE implemented * Permission check when starting tournament * Remove IGN from upsert * View match results page * Source in DB * Match page waiting for teams * Move tournament bracket to feature folder * REOPEN_MATCH initial * Handle proper resetting of match * Inline bracket-manager * Syncify * Transactions * Handle match is locked gracefully * Match page auto refresh * Fix match refresh called "globally" * Bracket autoupdate * Move fillWithNullTillPowerOfTwo to utils with testing * Fix map lists not visible after tournament started * Optimize match events * Show UI while in progress to members * Fix start tournament alert not being responsive * Teams can check in * Fix map list 400 * xxx -> TODO * Seeds page * Remove map icons for team page * Don't display link to seeds after tournament has started * Admin actions initial * Change captain admin action * Make all hooks ts * Admin actions functioning * Fix validate error not displaying in CatchBoundary * Adjust validate args order * Remove admin loader * Make delete team button menancing * Only include checked in teams to bracket * Optimize to.id route loads * Working show map list generator toggle * Update full tournaments flow * Make full tournaments work with many start times * Handle undefined in crud * Dynamic stage banner * Handle default strat if map list generation fails * Fix crash on brackets if less than 2 teams * Add commented out test for reference * Add TODO * Add players from team during register * TrustRelationship * Prefers not to host feature * Last before merge * Rename some vars * More renames
132 lines
4.5 KiB
JavaScript
132 lines
4.5 KiB
JavaScript
module.exports.up = function (db) {
|
|
db.prepare(
|
|
/*sql*/ `alter table "CalendarEvent" drop column "isBeforeStart"`
|
|
).run();
|
|
|
|
db.prepare(/*sql*/ `drop table "TournamentTeam"`).run();
|
|
db.prepare(
|
|
/*sql*/ `
|
|
create table "TournamentTeam" (
|
|
"id" integer primary key,
|
|
"name" text,
|
|
"friendCode" text,
|
|
"createdAt" integer default (strftime('%s', 'now')) not null,
|
|
"seed" integer,
|
|
"checkedInAt" integer,
|
|
"inviteCode" text not null unique,
|
|
"calendarEventId" integer not null,
|
|
foreign key ("calendarEventId") references "CalendarEvent"("id") on delete cascade,
|
|
unique("calendarEventId", "name") on conflict rollback
|
|
) strict
|
|
`
|
|
).run();
|
|
db.prepare(
|
|
`create index tournament_team_calendar_event_id on "TournamentTeam"("calendarEventId")`
|
|
).run();
|
|
|
|
db.prepare(/*sql*/ `drop table "TournamentTeamMember"`).run();
|
|
db.prepare(
|
|
/*sql*/ `
|
|
create table "TournamentTeamMember" (
|
|
"tournamentTeamId" integer not null,
|
|
"userId" integer not null,
|
|
"isOwner" integer not null default 0,
|
|
"createdAt" integer default (strftime('%s', 'now')) not null,
|
|
foreign key ("tournamentTeamId") references "TournamentTeam"("id") on delete cascade,
|
|
unique("tournamentTeamId", "userId") on conflict rollback
|
|
) strict
|
|
`
|
|
).run();
|
|
db.prepare(
|
|
/*sql*/ `create index tournament_team_member_tournament_team_id on "TournamentTeamMember"("tournamentTeamId")`
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `
|
|
create table "TournamentBracket" (
|
|
"id" integer primary key,
|
|
"calendarEventId" integer not null,
|
|
"type" text not null,
|
|
foreign key ("calendarEventId") references "CalendarEvent"("id") on delete restrict
|
|
) strict
|
|
`
|
|
).run();
|
|
db.prepare(
|
|
/*sql*/ `create index tournament_bracket_calendar_event_id on "TournamentBracket"("calendarEventId")`
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `
|
|
create table "TournamentRound" (
|
|
"id" integer primary key,
|
|
"position" integer not null,
|
|
"bracketId" integer not null,
|
|
"bestOf" integer not null,
|
|
foreign key ("bracketId") references "TournamentBracket"("id") on delete cascade,
|
|
unique("bracketId", "position") on conflict rollback
|
|
) strict
|
|
`
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `
|
|
create table "TournamentMatch" (
|
|
"id" integer primary key,
|
|
"roundId" integer not null,
|
|
"number" integer,
|
|
"position" integer not null,
|
|
"winnerDestinationMatchId" integer,
|
|
"loserDestinationMatchId" integer,
|
|
foreign key ("roundId") references "TournamentRound"("id") on delete cascade,
|
|
foreign key ("winnerDestinationMatchId") references "TournamentMatch"("id") on delete restrict,
|
|
foreign key ("loserDestinationMatchId") references "TournamentMatch"("id") on delete restrict
|
|
) strict
|
|
`
|
|
).run();
|
|
db.prepare(
|
|
/*sql*/ `create index tournament_match_round_id on "TournamentMatch"("roundId")`
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `
|
|
create table "TournamentMatchParticipant" (
|
|
"order" text not null,
|
|
"teamId" integer not null,
|
|
"matchId" integer not null,
|
|
foreign key ("teamId") references "TournamentTeam"("id") on delete restrict,
|
|
foreign key ("matchId") references "TournamentMatch"("id") on delete restrict,
|
|
unique("teamId", "matchId") on conflict rollback
|
|
) strict
|
|
`
|
|
).run();
|
|
db.prepare(
|
|
/*sql*/ `create index tournament_match_participant_team_id on "TournamentMatchParticipant"("teamId")`
|
|
).run();
|
|
db.prepare(
|
|
/*sql*/ `create index tournament_match_participant_match_id on "TournamentMatchParticipant"("matchId")`
|
|
).run();
|
|
|
|
db.prepare(
|
|
/*sql*/ `
|
|
create table "TournamentMatchGameResult" (
|
|
"id" integer primary key,
|
|
"matchId" integer unique not null,
|
|
"stageId" integer not null,
|
|
"mode" text not null,
|
|
"winnerTeamId" integer not null,
|
|
"reporterId" integer not null,
|
|
"createdAt" integer default (strftime('%s', 'now')) not null,
|
|
foreign key ("matchId") references "TournamentMatch"("id") on delete cascade,
|
|
foreign key ("winnerTeamId") references "TournamentTeam"("id") on delete restrict,
|
|
foreign key ("reporterId") references "User"("id") on delete restrict
|
|
) strict
|
|
`
|
|
).run();
|
|
db.prepare(
|
|
/*sql*/ `create index tournament_match_game_result_match_id on "TournamentMatchGameResult"("matchId")`
|
|
).run();
|
|
db.prepare(
|
|
/*sql*/ `create index tournament_match_game_result_winner_team_id on "TournamentMatchGameResult"("winnerTeamId")`
|
|
).run();
|
|
};
|