From a3459bd12eaf74d1afc6448084284ff7c0832d60 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Thu, 29 Feb 2024 21:35:46 +0200 Subject: [PATCH] Fix migrations --- migrations/{000-initial.cjs => 000-initial.js} | 8 ++++---- migrations/{001-badges.cjs => 001-badges.js} | 8 ++++---- .../{002-fix-plus-tier.cjs => 002-fix-plus-tier.js} | 8 ++++---- migrations/{003-badges-hue.cjs => 003-badges-hue.js} | 8 ++++---- migrations/{004-itz-badges.cjs => 004-itz-badges.js} | 8 ++++---- migrations/{005-patrons.cjs => 005-patrons.js} | 8 ++++---- migrations/{006-calendar.cjs => 006-calendar.js} | 8 ++++---- migrations/{007-builds.cjs => 007-builds.js} | 8 ++++---- .../{008-user-new-fields.cjs => 008-user-new-fields.js} | 8 ++++---- migrations/{009-maps.cjs => 009-maps.js} | 8 ++++---- migrations/{010-fix-maps.cjs => 010-fix-maps.js} | 8 ++++---- ...esult-highlights.cjs => 011-user-result-highlights.js} | 8 ++++---- migrations/{012-to-tools.cjs => 012-to-tools.js} | 8 ++++---- migrations/{013-weapon-pool.cjs => 013-weapon-pool.js} | 8 ++++---- .../{014-full-tournament.cjs => 014-full-tournament.js} | 4 ++-- migrations/{015-teams.cjs => 015-teams.js} | 4 ++-- ...just-submitted-img.cjs => 016-adjust-submitted-img.js} | 4 ++-- ...persisted-plus-tier.cjs => 017-persisted-plus-tier.js} | 4 ++-- ...018-add-user-team-css.cjs => 018-add-user-team-css.js} | 4 ++-- .../{019-add-patron-till.cjs => 019-add-patron-till.js} | 4 ++-- migrations/{020-vods.cjs => 020-vods.js} | 4 ++-- migrations/{021-abilities.cjs => 021-abilities.js} | 4 ++-- migrations/{022-xrank.cjs => 022-xrank.js} | 4 ++-- ...3-add-user-fav-badge.cjs => 023-add-user-fav-badge.js} | 4 ++-- ...024-adjust-tournament.cjs => 024-adjust-tournament.js} | 4 ++-- .../{025-private-builds.cjs => 025-private-builds.js} | 4 ++-- ...6-full-tournament-v2.cjs => 026-full-tournament-v2.js} | 4 ++-- .../{027-tournament-subs.cjs => 027-tournament-subs.js} | 4 ++-- migrations/{028-user-changes.cjs => 028-user-changes.js} | 4 ++-- .../{029-end-tournament.cjs => 029-end-tournament.js} | 4 ++-- migrations/{030-art.cjs => 030-art.js} | 4 ++-- migrations/{031-art-tags.cjs => 031-art-tags.js} | 4 ++-- migrations/{032-q.cjs => 032-q.js} | 4 ++-- migrations/{033-banned.cjs => 033-banned.js} | 4 ++-- migrations/{034-vc.cjs => 034-vc.js} | 4 ++-- migrations/{035-log-in-link.cjs => 035-log-in-link.js} | 4 ++-- .../{036-add-chat-code.cjs => 036-add-chat-code.js} | 4 ++-- migrations/{037-add-memento.cjs => 037-add-memento.js} | 4 ++-- ...038-group-member-note.cjs => 038-group-member-note.js} | 4 ++-- ...ch-chat-code.cjs => 039-tournament-match-chat-code.js} | 4 ++-- migrations/{040-indexes.cjs => 040-indexes.js} | 4 ++-- migrations/{041-plus-sixty.cjs => 041-plus-sixty.js} | 4 ++-- migrations/{042-plus-skipped.cjs => 042-plus-skipped.js} | 4 ++-- .../{043-q-new-map-pick.cjs => 043-q-new-map-pick.js} | 4 ++-- migrations/{044-no-screen.cjs => 044-no-screen.js} | 4 ++-- .../{045-tournament-staff.cjs => 045-tournament-staff.js} | 4 ++-- ...ment-progression.cjs => 046-tournament-progression.js} | 4 ++-- .../{047-bracket-stuff.cjs => 047-bracket-stuff.js} | 4 ++-- migrations/{048-season-3-sq.cjs => 048-season-3-sq.js} | 4 ++-- 49 files changed, 126 insertions(+), 126 deletions(-) rename migrations/{000-initial.cjs => 000-initial.js} (97%) rename migrations/{001-badges.cjs => 001-badges.js} (97%) rename migrations/{002-fix-plus-tier.cjs => 002-fix-plus-tier.js} (95%) rename migrations/{003-badges-hue.cjs => 003-badges-hue.js} (71%) rename migrations/{004-itz-badges.cjs => 004-itz-badges.js} (86%) rename migrations/{005-patrons.cjs => 005-patrons.js} (94%) rename migrations/{006-calendar.cjs => 006-calendar.js} (96%) rename migrations/{007-builds.cjs => 007-builds.js} (95%) rename migrations/{008-user-new-fields.cjs => 008-user-new-fields.js} (89%) rename migrations/{009-maps.cjs => 009-maps.js} (93%) rename migrations/{010-fix-maps.cjs => 010-fix-maps.js} (95%) rename migrations/{011-user-result-highlights.cjs => 011-user-result-highlights.js} (89%) rename migrations/{012-to-tools.cjs => 012-to-tools.js} (97%) rename migrations/{013-weapon-pool.cjs => 013-weapon-pool.js} (87%) rename migrations/{014-full-tournament.cjs => 014-full-tournament.js} (99%) rename migrations/{015-teams.cjs => 015-teams.js} (98%) rename migrations/{016-adjust-submitted-img.cjs => 016-adjust-submitted-img.js} (93%) rename migrations/{017-persisted-plus-tier.cjs => 017-persisted-plus-tier.js} (97%) rename migrations/{018-add-user-team-css.cjs => 018-add-user-team-css.js} (77%) rename migrations/{019-add-patron-till.cjs => 019-add-patron-till.js} (66%) rename migrations/{020-vods.cjs => 020-vods.js} (98%) rename migrations/{021-abilities.cjs => 021-abilities.js} (81%) rename migrations/{022-xrank.cjs => 022-xrank.js} (96%) rename migrations/{023-add-user-fav-badge.cjs => 023-add-user-fav-badge.js} (70%) rename migrations/{024-adjust-tournament.cjs => 024-adjust-tournament.js} (88%) rename migrations/{025-private-builds.cjs => 025-private-builds.js} (70%) rename migrations/{026-full-tournament-v2.cjs => 026-full-tournament-v2.js} (99%) rename migrations/{027-tournament-subs.cjs => 027-tournament-subs.js} (93%) rename migrations/{028-user-changes.cjs => 028-user-changes.js} (88%) rename migrations/{029-end-tournament.cjs => 029-end-tournament.js} (98%) rename migrations/{030-art.cjs => 030-art.js} (97%) rename migrations/{031-art-tags.cjs => 031-art-tags.js} (95%) rename migrations/{032-q.cjs => 032-q.js} (99%) rename migrations/{033-banned.cjs => 033-banned.js} (70%) rename migrations/{034-vc.cjs => 034-vc.js} (82%) rename migrations/{035-log-in-link.cjs => 035-log-in-link.js} (87%) rename migrations/{036-add-chat-code.cjs => 036-add-chat-code.js} (82%) rename migrations/{037-add-memento.cjs => 037-add-memento.js} (74%) rename migrations/{038-group-member-note.cjs => 038-group-member-note.js} (73%) rename migrations/{039-tournament-match-chat-code.cjs => 039-tournament-match-chat-code.js} (77%) rename migrations/{040-indexes.cjs => 040-indexes.js} (91%) rename migrations/{041-plus-sixty.cjs => 041-plus-sixty.js} (95%) rename migrations/{042-plus-skipped.cjs => 042-plus-skipped.js} (71%) rename migrations/{043-q-new-map-pick.cjs => 043-q-new-map-pick.js} (96%) rename migrations/{044-no-screen.cjs => 044-no-screen.js} (70%) rename migrations/{045-tournament-staff.cjs => 045-tournament-staff.js} (92%) rename migrations/{046-tournament-progression.cjs => 046-tournament-progression.js} (93%) rename migrations/{047-bracket-stuff.cjs => 047-bracket-stuff.js} (89%) rename migrations/{048-season-3-sq.cjs => 048-season-3-sq.js} (94%) diff --git a/migrations/000-initial.cjs b/migrations/000-initial.js similarity index 97% rename from migrations/000-initial.cjs rename to migrations/000-initial.js index 8482139cf..d081f555b 100644 --- a/migrations/000-initial.cjs +++ b/migrations/000-initial.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( ` create table "User" ( @@ -143,12 +143,12 @@ module.exports.up = function (db) { "votedId"; `, ).run(); -}; +} -module.exports.down = function (db) { +export function down(db) { db.prepare(`drop view "PlusVotingResult"`).run(); db.prepare(`drop view "PlusTier"`).run(); db.prepare(`drop table "User"`).run(); db.prepare(`drop table "PlusSuggestion"`).run(); db.prepare(`drop table "PlusVote"`).run(); -}; +} diff --git a/migrations/001-badges.cjs b/migrations/001-badges.js similarity index 97% rename from migrations/001-badges.cjs rename to migrations/001-badges.js index 8c4e1c9e8..2af65b04e 100644 --- a/migrations/001-badges.cjs +++ b/migrations/001-badges.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( ` create table "Badge" ( @@ -33,13 +33,13 @@ module.exports.up = function (db) { ) strict `, ).run(); -}; +} -module.exports.down = function (db) { +export function down(db) { db.prepare(`drop table "Badge"`).run(); db.prepare(`drop table "BadgeOwner"`).run(); db.prepare(`drop table "BadgeManager"`).run(); -}; +} function initialBadgesForDb() { return [ diff --git a/migrations/002-fix-plus-tier.cjs b/migrations/002-fix-plus-tier.js similarity index 95% rename from migrations/002-fix-plus-tier.cjs rename to migrations/002-fix-plus-tier.js index e57cfc618..5ad0837a1 100644 --- a/migrations/002-fix-plus-tier.cjs +++ b/migrations/002-fix-plus-tier.js @@ -1,6 +1,6 @@ // add missing min() call to handle multiple results w/ suggests correctly -module.exports.up = function (db) { +export function up(db) { db.prepare(`drop view "PlusTier"`).run(); db.prepare( @@ -50,9 +50,9 @@ module.exports.up = function (db) { "votedId"; `, ).run(); -}; +} -module.exports.down = function (db) { +export function down(db) { db.prepare(`drop view "PlusTier"`).run(); db.prepare( @@ -100,4 +100,4 @@ module.exports.down = function (db) { "votedId"; `, ).run(); -}; +} diff --git a/migrations/003-badges-hue.cjs b/migrations/003-badges-hue.js similarity index 71% rename from migrations/003-badges-hue.cjs rename to migrations/003-badges-hue.js index 204736910..ec9352645 100644 --- a/migrations/003-badges-hue.cjs +++ b/migrations/003-badges-hue.js @@ -1,8 +1,8 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare(`alter table "Badge" add "hue" integer`).run(); db.prepare(`update "Badge" set "hue" = -72 where "code" = 'ebtv'`).run(); -}; +} -module.exports.down = function (db) { +export function down(db) { db.prepare(`alter table "Badge" drop column "hue"`).run(); -}; +} diff --git a/migrations/004-itz-badges.cjs b/migrations/004-itz-badges.js similarity index 86% rename from migrations/004-itz-badges.cjs rename to migrations/004-itz-badges.js index 561c429e8..654089958 100644 --- a/migrations/004-itz-badges.cjs +++ b/migrations/004-itz-badges.js @@ -1,16 +1,16 @@ -module.exports.up = function (db) { +export function up(db) { for (const badge of itzBadges) { db.prepare( `insert into "Badge" ("code", "displayName") values ($code, $displayName)`, ).run(badge); } -}; +} -module.exports.down = function (db) { +export function down(db) { db.prepare( `delete from "Badge" where "code" in ('itz_red', 'itz_orange', 'itz_blue')`, ).run(); -}; +} const itzBadges = [ { diff --git a/migrations/005-patrons.cjs b/migrations/005-patrons.js similarity index 94% rename from migrations/005-patrons.cjs rename to migrations/005-patrons.js index 6032d637a..af473725f 100644 --- a/migrations/005-patrons.cjs +++ b/migrations/005-patrons.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare(`alter table "User" add column "patronTier" integer`).run(); db.prepare(`alter table "User" add column "patronSince" integer`).run(); @@ -33,9 +33,9 @@ module.exports.up = function (db) { where "patronTier" > 1 `, ).run(); -}; +} -module.exports.down = function (db) { +export function down(db) { db.prepare(`drop view "BadgeOwner"`).run(); db.prepare(`alter table "User" drop column "patronTier"`).run(); db.prepare(`alter table "User" drop column "patronSince"`).run(); @@ -45,4 +45,4 @@ module.exports.down = function (db) { ).run(); db.prepare(`alter table "TournamentBadgeOwner" rename to "BadgeOwner"`).run(); -}; +} diff --git a/migrations/006-calendar.cjs b/migrations/006-calendar.js similarity index 96% rename from migrations/006-calendar.cjs rename to migrations/006-calendar.js index 4481d374c..1c8035c3c 100644 --- a/migrations/006-calendar.cjs +++ b/migrations/006-calendar.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( ` create table "CalendarEvent" ( @@ -62,9 +62,9 @@ module.exports.up = function (db) { ) strict `, ).run(); -}; +} -module.exports.down = function (db) { +export function down(db) { for (const table of [ "CalendarEventDate", "CalendarEventResultPlayer", @@ -74,4 +74,4 @@ module.exports.down = function (db) { ]) { db.prepare(`drop table "${table}"`).run(); } -}; +} diff --git a/migrations/007-builds.cjs b/migrations/007-builds.js similarity index 95% rename from migrations/007-builds.cjs rename to migrations/007-builds.js index d7cb53458..a76790fb4 100644 --- a/migrations/007-builds.cjs +++ b/migrations/007-builds.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( ` create table "Build" ( @@ -46,10 +46,10 @@ module.exports.up = function (db) { db.prepare( `create index build_ability_build_id on "BuildAbility"("buildId")`, ).run(); -}; +} -module.exports.down = function (db) { +export function down(db) { for (const table of ["Build", "BuildWeapon", "BuildAbility"]) { db.prepare(`drop table "${table}"`).run(); } -}; +} diff --git a/migrations/008-user-new-fields.cjs b/migrations/008-user-new-fields.js similarity index 89% rename from migrations/008-user-new-fields.cjs rename to migrations/008-user-new-fields.js index d2d6ba87c..92b661883 100644 --- a/migrations/008-user-new-fields.cjs +++ b/migrations/008-user-new-fields.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare(`alter table "User" add "customUrl" text`).run(); db.prepare( `create unique index user_custom_url_unique on "User"("customUrl")`, @@ -8,12 +8,12 @@ module.exports.up = function (db) { db.prepare(`alter table "User" add "motionSens" integer`).run(); db.prepare(`alter table "User" add "inGameName" text`).run(); -}; +} -module.exports.down = function (db) { +export function down(db) { db.prepare(`drop index user_custom_url_unique`).run(); db.prepare(`alter table "User" drop column "customUrl"`).run(); db.prepare(`alter table "User" drop column "stickSens"`).run(); db.prepare(`alter table "User" drop column "motionSens"`).run(); db.prepare(`alter table "User" drop column "inGameName"`).run(); -}; +} diff --git a/migrations/009-maps.cjs b/migrations/009-maps.js similarity index 93% rename from migrations/009-maps.cjs rename to migrations/009-maps.js index 36cb20c51..2f83ab858 100644 --- a/migrations/009-maps.cjs +++ b/migrations/009-maps.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( ` create table "MapPool" ( @@ -31,13 +31,13 @@ module.exports.up = function (db) { db.prepare( `create index calendar_event_map_pool_id on "CalendarEvent"("mapPoolId")`, ).run(); -}; +} -module.exports.down = function (db) { +export function down(db) { for (const table of ["MapPool", "MapPoolMap"]) { db.prepare(`drop table "${table}"`).run(); } db.prepare(`drop index calendar_event_map_pool_id`).run(); db.prepare(`alter table "CalendarEvent" drop column "mapPoolId"`).run(); -}; +} diff --git a/migrations/010-fix-maps.cjs b/migrations/010-fix-maps.js similarity index 95% rename from migrations/010-fix-maps.cjs rename to migrations/010-fix-maps.js index 693a0d649..919b0d445 100644 --- a/migrations/010-fix-maps.cjs +++ b/migrations/010-fix-maps.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { for (const table of ["MapPool", "MapPoolMap"]) { db.prepare(`drop table "${table}"`).run(); } @@ -22,9 +22,9 @@ module.exports.up = function (db) { db.prepare( `create index map_pool_map_calendar_event_id on "MapPoolMap"("calendarEventId")`, ).run(); -}; +} -module.exports.down = function (db) { +export function down(db) { db.prepare(`drop table "MapPoolMap"`).run(); // --- @@ -61,4 +61,4 @@ module.exports.down = function (db) { db.prepare( `create index calendar_event_map_pool_id on "CalendarEvent"("mapPoolId")`, ).run(); -}; +} diff --git a/migrations/011-user-result-highlights.cjs b/migrations/011-user-result-highlights.js similarity index 89% rename from migrations/011-user-result-highlights.cjs rename to migrations/011-user-result-highlights.js index e103f79fc..2534a0096 100644 --- a/migrations/011-user-result-highlights.cjs +++ b/migrations/011-user-result-highlights.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( ` create table "UserResultHighlight" ( @@ -18,8 +18,8 @@ module.exports.up = function (db) { db.prepare( `create index user_result_highlight_team_id on "UserResultHighlight"("teamId")`, ).run(); -}; +} -module.exports.down = function (db) { +export function down(db) { db.prepare(`drop table "UserResultHighlight"`).run(); -}; +} diff --git a/migrations/012-to-tools.cjs b/migrations/012-to-tools.js similarity index 97% rename from migrations/012-to-tools.cjs rename to migrations/012-to-tools.js index fd6460397..f374577d3 100644 --- a/migrations/012-to-tools.cjs +++ b/migrations/012-to-tools.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare(`alter table "CalendarEvent" add "customUrl" text`).run(); db.prepare( `alter table "CalendarEvent" add "toToolsEnabled" integer default 0`, @@ -54,9 +54,9 @@ module.exports.up = function (db) { db.prepare( `create index tournament_team_member_tournament_team_id on "TournamentTeamMember"("tournamentTeamId")`, ).run(); -}; +} -module.exports.down = function (db) { +export function down(db) { db.prepare(`drop index calendar_event_custom_url_unique`).run(); db.prepare(`drop index map_pool_map_tournament_team_id`).run(); db.prepare(`drop index map_pool_map_tie_breaker_calendar_event_id`).run(); @@ -74,4 +74,4 @@ module.exports.down = function (db) { db.prepare(`drop table "TournamentTeam"`).run(); db.prepare(`drop table "TournamentTeamMember"`).run(); -}; +} diff --git a/migrations/013-weapon-pool.cjs b/migrations/013-weapon-pool.js similarity index 87% rename from migrations/013-weapon-pool.cjs rename to migrations/013-weapon-pool.js index eece44edb..2a121d0e5 100644 --- a/migrations/013-weapon-pool.cjs +++ b/migrations/013-weapon-pool.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( ` create table "UserWeapon" ( @@ -16,8 +16,8 @@ module.exports.up = function (db) { db.prepare( `create index user_weapon_user_id on "UserWeapon"("userId")`, ).run(); -}; +} -module.exports.down = function (db) { +export function down(db) { db.prepare(`drop table "UserWeapon"`).run(); -}; +} diff --git a/migrations/014-full-tournament.cjs b/migrations/014-full-tournament.js similarity index 99% rename from migrations/014-full-tournament.cjs rename to migrations/014-full-tournament.js index 1786cd305..180fea7af 100644 --- a/migrations/014-full-tournament.cjs +++ b/migrations/014-full-tournament.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( /*sql*/ `alter table "CalendarEvent" drop column "isBeforeStart"`, ).run(); @@ -128,4 +128,4 @@ module.exports.up = function (db) { db.prepare( /*sql*/ `create index tournament_match_game_result_winner_team_id on "TournamentMatchGameResult"("winnerTeamId")`, ).run(); -}; +} diff --git a/migrations/015-teams.cjs b/migrations/015-teams.js similarity index 98% rename from migrations/015-teams.cjs rename to migrations/015-teams.js index b37ce43e7..31603389d 100644 --- a/migrations/015-teams.cjs +++ b/migrations/015-teams.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( /*sql*/ ` create table "UnvalidatedUserSubmittedImage" ( @@ -74,4 +74,4 @@ module.exports.up = function (db) { "Team"."id" is not null `, ).run(); -}; +} diff --git a/migrations/016-adjust-submitted-img.cjs b/migrations/016-adjust-submitted-img.js similarity index 93% rename from migrations/016-adjust-submitted-img.cjs rename to migrations/016-adjust-submitted-img.js index 126b190fe..162f5ea1c 100644 --- a/migrations/016-adjust-submitted-img.cjs +++ b/migrations/016-adjust-submitted-img.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( /* sql */ ` drop table "UnvalidatedUserSubmittedImage" @@ -20,4 +20,4 @@ module.exports.up = function (db) { db.prepare( `create index submitter_user_id on "UnvalidatedUserSubmittedImage"("submitterUserId")`, ).run(); -}; +} diff --git a/migrations/017-persisted-plus-tier.cjs b/migrations/017-persisted-plus-tier.js similarity index 97% rename from migrations/017-persisted-plus-tier.cjs rename to migrations/017-persisted-plus-tier.js index 9ca156fe7..002685c08 100644 --- a/migrations/017-persisted-plus-tier.cjs +++ b/migrations/017-persisted-plus-tier.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare(`drop view "PlusTier"`).run(); db.prepare( @@ -64,4 +64,4 @@ module.exports.up = function (db) { insert into "PlusTier" ("userId", "tier") select "userId", "tier" from "FreshPlusTier" where "tier" is not null; `, ).run(); -}; +} diff --git a/migrations/018-add-user-team-css.cjs b/migrations/018-add-user-team-css.js similarity index 77% rename from migrations/018-add-user-team-css.cjs rename to migrations/018-add-user-team-css.js index bc6ac56a6..99f4eb4ae 100644 --- a/migrations/018-add-user-team-css.cjs +++ b/migrations/018-add-user-team-css.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare(/* sql */ `alter table "User" add "css" text`).run(); db.prepare(/* sql */ `alter table "AllTeam" add "css" text`).run(); -}; +} diff --git a/migrations/019-add-patron-till.cjs b/migrations/019-add-patron-till.js similarity index 66% rename from migrations/019-add-patron-till.cjs rename to migrations/019-add-patron-till.js index e09989927..0ee672415 100644 --- a/migrations/019-add-patron-till.cjs +++ b/migrations/019-add-patron-till.js @@ -1,3 +1,3 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare(/* sql */ `alter table "User" add "patronTill" integer`).run(); -}; +} diff --git a/migrations/020-vods.cjs b/migrations/020-vods.js similarity index 98% rename from migrations/020-vods.cjs rename to migrations/020-vods.js index 24e48f2c6..cbb14720e 100644 --- a/migrations/020-vods.cjs +++ b/migrations/020-vods.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( `alter table "User" add column "isVideoAdder" integer default 0`, ).run(); @@ -67,4 +67,4 @@ module.exports.up = function (db) { db.prepare( `create index video_match_player_player_user_id on "VideoMatchPlayer"("playerUserId")`, ).run(); -}; +} diff --git a/migrations/021-abilities.cjs b/migrations/021-abilities.js similarity index 81% rename from migrations/021-abilities.cjs rename to migrations/021-abilities.js index 0a5098650..37f973435 100644 --- a/migrations/021-abilities.cjs +++ b/migrations/021-abilities.js @@ -1,5 +1,5 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( /* sql */ `alter table "BuildAbility" add "abilityPoints" integer generated always as (case when "slotIndex" = 0 then 10 else 3 end) virtual`, ).run(); -}; +} diff --git a/migrations/022-xrank.cjs b/migrations/022-xrank.js similarity index 96% rename from migrations/022-xrank.cjs rename to migrations/022-xrank.js index ac30228c1..836c31f47 100644 --- a/migrations/022-xrank.cjs +++ b/migrations/022-xrank.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( /*sql*/ ` create table "XRankPlacement" ( @@ -40,4 +40,4 @@ module.exports.up = function (db) { db.prepare( `create index splatoon_player_user_id on "SplatoonPlayer"("userId")`, ).run(); -}; +} diff --git a/migrations/023-add-user-fav-badge.cjs b/migrations/023-add-user-fav-badge.js similarity index 70% rename from migrations/023-add-user-fav-badge.cjs rename to migrations/023-add-user-fav-badge.js index 4d5ff22eb..b3f848102 100644 --- a/migrations/023-add-user-fav-badge.cjs +++ b/migrations/023-add-user-fav-badge.js @@ -1,5 +1,5 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( /* sql */ `alter table "User" add "favoriteBadgeId" integer`, ).run(); -}; +} diff --git a/migrations/024-adjust-tournament.cjs b/migrations/024-adjust-tournament.js similarity index 88% rename from migrations/024-adjust-tournament.cjs rename to migrations/024-adjust-tournament.js index 2a5479252..6bec45f81 100644 --- a/migrations/024-adjust-tournament.cjs +++ b/migrations/024-adjust-tournament.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( /* sql */ `alter table "CalendarEvent" add "isBeforeStart" integer default 1`, ).run(); @@ -9,4 +9,4 @@ module.exports.up = function (db) { db.prepare( /* sql */ `alter table "TournamentTeam" drop column "friendCode"`, ).run(); -}; +} diff --git a/migrations/025-private-builds.cjs b/migrations/025-private-builds.js similarity index 70% rename from migrations/025-private-builds.cjs rename to migrations/025-private-builds.js index 54ce4ca61..d5785e41e 100644 --- a/migrations/025-private-builds.cjs +++ b/migrations/025-private-builds.js @@ -1,5 +1,5 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( /* sql */ `alter table "Build" add "private" integer default 0`, ).run(); -}; +} diff --git a/migrations/026-full-tournament-v2.cjs b/migrations/026-full-tournament-v2.js similarity index 99% rename from migrations/026-full-tournament-v2.cjs rename to migrations/026-full-tournament-v2.js index 97e81af62..f7d55abf8 100644 --- a/migrations/026-full-tournament-v2.cjs +++ b/migrations/026-full-tournament-v2.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare(/* sql */ `drop index "calendar_event_custom_url_unique"`).run(); db.prepare(/*sql*/ `drop table "TournamentBracket"`).run(); db.prepare(/*sql*/ `drop table "TournamentMatchParticipant"`).run(); @@ -231,4 +231,4 @@ module.exports.up = function (db) { db.prepare( `create index trust_relationship_trust_receiver_user_id on "TrustRelationship"("trustReceiverUserId")`, ).run(); -}; +} diff --git a/migrations/027-tournament-subs.cjs b/migrations/027-tournament-subs.js similarity index 93% rename from migrations/027-tournament-subs.cjs rename to migrations/027-tournament-subs.js index 5396940e2..31fbbf25c 100644 --- a/migrations/027-tournament-subs.cjs +++ b/migrations/027-tournament-subs.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( /*sql*/ ` create table "TournamentSub" ( @@ -16,4 +16,4 @@ module.exports.up = function (db) { ) strict `, ).run(); -}; +} diff --git a/migrations/028-user-changes.cjs b/migrations/028-user-changes.js similarity index 88% rename from migrations/028-user-changes.cjs rename to migrations/028-user-changes.js index d736b49ab..399ec6cd7 100644 --- a/migrations/028-user-changes.cjs +++ b/migrations/028-user-changes.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare(/* sql */ `alter table "User" add "discordUniqueName" text`).run(); db.prepare( /* sql */ `alter table "User" add "showDiscordUniqueName" integer not null default 1`, @@ -6,4 +6,4 @@ module.exports.up = function (db) { db.prepare( /* sql */ `alter table "UserWeapon" add "isFavorite" integer not null default 0`, ).run(); -}; +} diff --git a/migrations/029-end-tournament.cjs b/migrations/029-end-tournament.js similarity index 98% rename from migrations/029-end-tournament.cjs rename to migrations/029-end-tournament.js index 49386777c..070d35385 100644 --- a/migrations/029-end-tournament.cjs +++ b/migrations/029-end-tournament.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( `create index tournament_sub_user_id on "TournamentSub"("userId")`, ).run(); @@ -111,4 +111,4 @@ module.exports.up = function (db) { db.prepare( `create index tournament_result_tournament_id on "TournamentResult"("tournamentId")`, ).run(); -}; +} diff --git a/migrations/030-art.cjs b/migrations/030-art.js similarity index 97% rename from migrations/030-art.cjs rename to migrations/030-art.js index 274ef0e34..601a99ca0 100644 --- a/migrations/030-art.cjs +++ b/migrations/030-art.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( /* sql */ `alter table "User" add "commissionsOpen" integer default 0`, ).run(); @@ -42,4 +42,4 @@ module.exports.up = function (db) { db.prepare( `create index art_user_metadata_user_id on "ArtUserMetadata"("userId")`, ).run(); -}; +} diff --git a/migrations/031-art-tags.cjs b/migrations/031-art-tags.js similarity index 95% rename from migrations/031-art-tags.cjs rename to migrations/031-art-tags.js index 76e302287..96693d131 100644 --- a/migrations/031-art-tags.cjs +++ b/migrations/031-art-tags.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( /*sql*/ ` create table "ArtTag" ( @@ -24,4 +24,4 @@ module.exports.up = function (db) { db.prepare(`create index tagged_art_art_id on "TaggedArt"("artId")`).run(); db.prepare(`create index tagged_art_tag_id on "TaggedArt"("tagId")`).run(); -}; +} diff --git a/migrations/032-q.cjs b/migrations/032-q.js similarity index 99% rename from migrations/032-q.cjs rename to migrations/032-q.js index 90ece4dda..a0497858e 100644 --- a/migrations/032-q.cjs +++ b/migrations/032-q.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.transaction(() => { db.prepare(`delete from "Skill"`).run(); db.prepare(`create index skill_identifier on "Skill"("identifier")`).run(); @@ -197,4 +197,4 @@ module.exports.up = function (db) { `create index reported_weapon_user_id on "ReportedWeapon"("userId")`, ).run(); })(); -}; +} diff --git a/migrations/033-banned.cjs b/migrations/033-banned.js similarity index 70% rename from migrations/033-banned.cjs rename to migrations/033-banned.js index 49c246e17..12e74ac10 100644 --- a/migrations/033-banned.cjs +++ b/migrations/033-banned.js @@ -1,5 +1,5 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( /* sql */ `alter table "User" add "banned" integer default 0`, ).run(); -}; +} diff --git a/migrations/034-vc.cjs b/migrations/034-vc.js similarity index 82% rename from migrations/034-vc.cjs rename to migrations/034-vc.js index 2d11e2d9a..af34c698a 100644 --- a/migrations/034-vc.cjs +++ b/migrations/034-vc.js @@ -1,6 +1,6 @@ -module.exports.up = function (db) { +export function up(db) { db.transaction(() => { db.prepare(/* sql */ `alter table "User" add "vc" text default "NO"`).run(); db.prepare(/* sql */ `alter table "User" add "languages" text`).run(); })(); -}; +} diff --git a/migrations/035-log-in-link.cjs b/migrations/035-log-in-link.js similarity index 87% rename from migrations/035-log-in-link.cjs rename to migrations/035-log-in-link.js index 8479753d0..868daf82e 100644 --- a/migrations/035-log-in-link.cjs +++ b/migrations/035-log-in-link.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( /*sql*/ ` create table "LogInLink" ( @@ -9,4 +9,4 @@ module.exports.up = function (db) { ) strict `, ).run(); -}; +} diff --git a/migrations/036-add-chat-code.cjs b/migrations/036-add-chat-code.js similarity index 82% rename from migrations/036-add-chat-code.cjs rename to migrations/036-add-chat-code.js index d52d455af..f3b5b63b1 100644 --- a/migrations/036-add-chat-code.cjs +++ b/migrations/036-add-chat-code.js @@ -1,6 +1,6 @@ -module.exports.up = function (db) { +export function up(db) { db.transaction(() => { db.prepare(/* sql */ `alter table "Group" add "chatCode" text`).run(); db.prepare(/* sql */ `alter table "GroupMatch" add "chatCode" text`).run(); })(); -}; +} diff --git a/migrations/037-add-memento.cjs b/migrations/037-add-memento.js similarity index 74% rename from migrations/037-add-memento.cjs rename to migrations/037-add-memento.js index a6ebc3176..e0fb9f405 100644 --- a/migrations/037-add-memento.cjs +++ b/migrations/037-add-memento.js @@ -1,5 +1,5 @@ -module.exports.up = function (db) { +export function up(db) { db.transaction(() => { db.prepare(/* sql */ `alter table "GroupMatch" add "memento" text`).run(); })(); -}; +} diff --git a/migrations/038-group-member-note.cjs b/migrations/038-group-member-note.js similarity index 73% rename from migrations/038-group-member-note.cjs rename to migrations/038-group-member-note.js index abed86cdf..9d267f5c1 100644 --- a/migrations/038-group-member-note.cjs +++ b/migrations/038-group-member-note.js @@ -1,5 +1,5 @@ -module.exports.up = function (db) { +export function up(db) { db.transaction(() => { db.prepare(/* sql */ `alter table "GroupMember" add "note" text`).run(); })(); -}; +} diff --git a/migrations/039-tournament-match-chat-code.cjs b/migrations/039-tournament-match-chat-code.js similarity index 77% rename from migrations/039-tournament-match-chat-code.cjs rename to migrations/039-tournament-match-chat-code.js index bca3361d5..d12b57a90 100644 --- a/migrations/039-tournament-match-chat-code.cjs +++ b/migrations/039-tournament-match-chat-code.js @@ -1,7 +1,7 @@ -module.exports.up = function (db) { +export function up(db) { db.transaction(() => { db.prepare( /* sql */ `alter table "TournamentMatch" add "chatCode" text`, ).run(); })(); -}; +} diff --git a/migrations/040-indexes.cjs b/migrations/040-indexes.js similarity index 91% rename from migrations/040-indexes.cjs rename to migrations/040-indexes.js index 5e3c19348..73bee4384 100644 --- a/migrations/040-indexes.cjs +++ b/migrations/040-indexes.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.transaction(() => { db.prepare( /* sql */ `create index user_patron_tier on "User"("patronTier")`, @@ -11,4 +11,4 @@ module.exports.up = function (db) { /* sql */ `create index calendar_event_result_player_team_id on "CalendarEventResultPlayer"("teamId")`, ).run(); })(); -}; +} diff --git a/migrations/041-plus-sixty.cjs b/migrations/041-plus-sixty.js similarity index 95% rename from migrations/041-plus-sixty.cjs rename to migrations/041-plus-sixty.js index ed0963799..d4758ad66 100644 --- a/migrations/041-plus-sixty.cjs +++ b/migrations/041-plus-sixty.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.transaction(() => { db.prepare(`drop view "PlusVotingResult"`).run(); @@ -34,4 +34,4 @@ module.exports.up = function (db) { `, ).run(); })(); -}; +} diff --git a/migrations/042-plus-skipped.cjs b/migrations/042-plus-skipped.js similarity index 71% rename from migrations/042-plus-skipped.cjs rename to migrations/042-plus-skipped.js index 21b0891c3..47f45911e 100644 --- a/migrations/042-plus-skipped.cjs +++ b/migrations/042-plus-skipped.js @@ -1,5 +1,5 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( /* sql */ `alter table "User" add "plusSkippedForSeasonNth" integer`, ).run(); -}; +} diff --git a/migrations/043-q-new-map-pick.cjs b/migrations/043-q-new-map-pick.js similarity index 96% rename from migrations/043-q-new-map-pick.cjs rename to migrations/043-q-new-map-pick.js index 8b5e16104..093bdc768 100644 --- a/migrations/043-q-new-map-pick.cjs +++ b/migrations/043-q-new-map-pick.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.transaction(() => { db.prepare( /* sql */ `alter table "User" add "mapModePreferences" text`, @@ -26,4 +26,4 @@ module.exports.up = function (db) { `, ).run(); })(); -}; +} diff --git a/migrations/044-no-screen.cjs b/migrations/044-no-screen.js similarity index 70% rename from migrations/044-no-screen.cjs rename to migrations/044-no-screen.js index 04d96fa29..d17dad843 100644 --- a/migrations/044-no-screen.cjs +++ b/migrations/044-no-screen.js @@ -1,5 +1,5 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( /* sql */ `alter table "User" add "noScreen" integer default 0`, ).run(); -}; +} diff --git a/migrations/045-tournament-staff.cjs b/migrations/045-tournament-staff.js similarity index 92% rename from migrations/045-tournament-staff.cjs rename to migrations/045-tournament-staff.js index b64f9d7db..6cc719c45 100644 --- a/migrations/045-tournament-staff.cjs +++ b/migrations/045-tournament-staff.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( /*sql*/ ` create table "TournamentStaff" ( @@ -15,4 +15,4 @@ module.exports.up = function (db) { db.prepare( /* sql */ `alter table "Tournament" add "castTwitchAccounts" text`, ).run(); -}; +} diff --git a/migrations/046-tournament-progression.cjs b/migrations/046-tournament-progression.js similarity index 93% rename from migrations/046-tournament-progression.cjs rename to migrations/046-tournament-progression.js index 3b9db6687..7347d9f87 100644 --- a/migrations/046-tournament-progression.cjs +++ b/migrations/046-tournament-progression.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.prepare( /* sql */ `alter table "Tournament" add "settings" text not null default '{"bracketProgression":[{"type":"double_elimination","name":"Main bracket"}]}'`, ).run(); @@ -15,4 +15,4 @@ module.exports.up = function (db) { db.prepare( /* sql */ `alter table "TournamentMatchGameResult" add "opponentTwoPoints" integer`, ).run(); -}; +} diff --git a/migrations/047-bracket-stuff.cjs b/migrations/047-bracket-stuff.js similarity index 89% rename from migrations/047-bracket-stuff.cjs rename to migrations/047-bracket-stuff.js index 455d4e37c..ee84ddf39 100644 --- a/migrations/047-bracket-stuff.cjs +++ b/migrations/047-bracket-stuff.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.transaction(() => { db.prepare( /* sql */ `alter table "TournamentStage" add "createdAt" integer`, @@ -12,4 +12,4 @@ module.exports.up = function (db) { /* sql */ `alter table "TournamentMatch" drop "childCount"`, ).run(); })(); -}; +} diff --git a/migrations/048-season-3-sq.cjs b/migrations/048-season-3-sq.js similarity index 94% rename from migrations/048-season-3-sq.cjs rename to migrations/048-season-3-sq.js index a634766db..f8f949f57 100644 --- a/migrations/048-season-3-sq.cjs +++ b/migrations/048-season-3-sq.js @@ -1,4 +1,4 @@ -module.exports.up = function (db) { +export function up(db) { db.transaction(() => { db.prepare(/* sql */ `update "User" set "mapModePreferences" = null`).run(); db.prepare(/* sql */ `update "User" set "noScreen" = 0`).run(); @@ -20,4 +20,4 @@ module.exports.up = function (db) { `, ).run(); })(); -}; +}