From 873c5e941d58049f60de58b50bbc20ea81a04d9b Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Wed, 9 Sep 2026 22:03:30 +0300 Subject: [PATCH] Fix user page crash --- ...6-weapon-pool-widget-rename-weapons-key.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 migrations/20260909190156-weapon-pool-widget-rename-weapons-key.ts diff --git a/migrations/20260909190156-weapon-pool-widget-rename-weapons-key.ts b/migrations/20260909190156-weapon-pool-widget-rename-weapons-key.ts new file mode 100644 index 000000000..0e97c41f5 --- /dev/null +++ b/migrations/20260909190156-weapon-pool-widget-rename-weapons-key.ts @@ -0,0 +1,20 @@ +import { type Kysely, sql } from "kysely"; + +/** + * Some weapon pool widgets still carry the settings of the widget's first + * version ({ weapons: [...] }, dropped in June 2026), which the earlier backfill + * skipped as they were not null. Reading them crashed the whole user page, so + * every row without a weaponPool list gets the empty one which keeps showing + * the match profile pool. + */ +export async function up(db: Kysely): Promise { + await sql` + update "UserWidget" + set "widget" = json_object( + 'id', 'weapon-pool', + 'settings', json_object('weaponPool', json('[]')) + ) + where json_extract("widget", '$.id') = 'weapon-pool' + and json_extract("widget", '$.settings.weaponPool') is null + `.execute(db); +}