sendou.ink/migrations/051-pick-ban.js
Kalle b98b4af1ea
Ban/pick etc. (#1716)
* To BracketMapListDialog

* Working map list dialog + UI work

* Rename components

* Working version

* Counterpick info text

* PickBan

* Rearrange loader

* Working BAN_2

* Show error msg if pick/ban style selected but no rounds have it enabled

* OrganizerMatchMapListDialog

* Prepicked BAN_2

* Starter finder structure

* Prepicked + counterpick

* PLAY_ALL & visible chat to TO's after finalize

* Tweaks and handling edge cases

* Play all e2e test

* Allow viewing tournament info when it has started

* Desc markdown support

* Rules

* calendar.new loader refactor

* baseEvent refactor

* w/ staff

* Add 1h30min reg closes time

* As team

* Fix E2E test

* E2E tests

* MiniCheckinInfoBanner
2024-03-31 10:36:22 +03:00

33 lines
1.1 KiB
JavaScript

export function up(db) {
db.transaction(() => {
db.prepare(
/*sql*/ `
create table "TournamentMatchPickBanEvent" (
"type" text not null,
"stageId" integer not null,
"mode" text not null,
"matchId" integer not null,
"authorId" integer not null,
"number" integer not null,
"createdAt" integer default (strftime('%s', 'now')) not null,
foreign key ("authorId") references "User"("id") on delete restrict,
foreign key ("matchId") references "TournamentMatch"("id") on delete cascade,
unique("matchId", "number") on conflict rollback
) strict
`,
).run();
db.prepare(
/* sql */ `create index pick_ban_event_author_id on "TournamentMatchPickBanEvent"("authorId")`,
).run();
db.prepare(
/* sql */ `create index pick_ban_event_match_id on "TournamentMatchPickBanEvent"("matchId")`,
).run();
db.prepare(/* sql */ `alter table "Tournament" add "rules" text`).run();
db.prepare(
/* sql */ `alter table "TournamentTeam" add "teamId" integer`,
).run();
})();
}