mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-03-21 18:04:39 -05:00
* 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>
38 lines
904 B
JavaScript
38 lines
904 B
JavaScript
export function up(db) {
|
|
db.transaction(() => {
|
|
db.prepare(`drop view "PlusVotingResult"`).run();
|
|
|
|
// same as 000-initial.js except 60% criteria
|
|
db.prepare(
|
|
/* sql */ `
|
|
create view "PlusVotingResult" as
|
|
select
|
|
"votedId",
|
|
"tier",
|
|
avg("score") as "score",
|
|
avg("score") >= 0.2 as "passedVoting",
|
|
"month",
|
|
"year",
|
|
exists (
|
|
select
|
|
1
|
|
from
|
|
"PlusSuggestion"
|
|
where
|
|
"PlusSuggestion"."month" = "PlusVote"."month"
|
|
and "PlusSuggestion"."year" = "PlusVote"."year"
|
|
and "PlusSuggestion"."suggestedId" = "PlusVote"."votedId"
|
|
and "PlusSuggestion"."tier" = "PlusVote"."tier"
|
|
) as "wasSuggested"
|
|
from
|
|
"PlusVote"
|
|
group by
|
|
"votedId",
|
|
"tier",
|
|
"month",
|
|
"year";
|
|
`,
|
|
).run();
|
|
})();
|
|
}
|