From f17120960e8e99f6ea9b820467113df13ca2ebb5 Mon Sep 17 00:00:00 2001 From: Indigo Tang Date: Sun, 6 Jul 2025 12:47:56 +0000 Subject: [PATCH] I see this error with the app, reported by NextJS, please fix it. The er --- src/lib/db.ts | 12 ++++++++++++ toyshare.db-shm | Bin 32768 -> 32768 bytes toyshare.db-wal | Bin 65952 -> 70072 bytes 3 files changed, 12 insertions(+) diff --git a/src/lib/db.ts b/src/lib/db.ts index 2d28d87..5c9895c 100644 --- a/src/lib/db.ts +++ b/src/lib/db.ts @@ -29,6 +29,18 @@ function initDb() { bio TEXT ); `); + + // Migration: Add nickname column to users table if it doesn't exist + try { + const columns = db.prepare("PRAGMA table_info(users)").all(); + if (!columns.some((col: any) => col.name === 'nickname')) { + console.log("Adding 'nickname' column to 'users' table..."); + db.exec('ALTER TABLE users ADD COLUMN nickname TEXT'); + } + } catch (error) { + console.error("Error during 'users' table migration:", error); + } + // Create Toys Table if it doesn't exist db.exec(` diff --git a/toyshare.db-shm b/toyshare.db-shm index d60ca5fc8f03c35de53b33b645547589daa44862..1b4d7ffe6f696fa8c44860b754358f265c423b73 100644 GIT binary patch delta 161 zcmZo@U}|V!s+V}A%K!rGK+MR%ARq{&*?_ok+nUzLCH*m>FZZsvRL#*Wa(Umhb!^A| tNmUOt3JgHz{zn2(;feL0jEoyE>N-t)z`@GMz{()F@#0UW&3{~3tN;jfH2DAk delta 157 zcmZo@U}|V!s+V}A%K!pwK+MR%ARqu`x146USKhOJM(E4ED=t-YH1827U}9o$P*4D>Wd^ASVi;ham|`r>%%In%#mo1Qft9C~fv1)KEdL_jP`(`-H}dmv zHTp8Li;IghHdRhm=HDiuqmY-GoSm1Lo2n4v8WEzo`K@mcBMbizhJ%}B`K1{FK_w~; delta 11 Scmdn7m}NmTOT!k%1&jb4wgg=O