sendou.ink/migrations/051-pick-ban.js
Kalle fd48bced91
Migrate Prettier/Eslint/Stylelint setup to Biome (#1772)
* Initial

* CSS lint

* Test CI

* Add 1v1, 2v2, and 3v3 Tags (#1771)

* Initial

* CSS lint

* Test CI

* Rename step

---------

Co-authored-by: xi <104683822+ximk@users.noreply.github.com>
2024-06-24 13:07:17 +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();
})();
}