Skip to content

Commit

Permalink
fixed sql table that was missing userRapport inside account
Browse files Browse the repository at this point in the history
  • Loading branch information
nusk0 committed Feb 12, 2025
1 parent 56d5666 commit bceed3e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/adapter-sqlite/src/sqliteTables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ export const sqliteTables = `
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
-- Uncomment the following line to reset all user rapport values to 0
--UPDATE accounts SET userRapport = 0;
-- Table: accounts
CREATE TABLE IF NOT EXISTS "accounts" (
Expand All @@ -13,9 +11,17 @@ CREATE TABLE IF NOT EXISTS "accounts" (
"username" TEXT,
"email" TEXT NOT NULL,
"avatarUrl" TEXT,
"details" TEXT DEFAULT '{}' CHECK(json_valid("details")) -- Ensuring details is a valid JSON field
"details" TEXT DEFAULT '{}' CHECK(json_valid("details")), -- Ensuring details is a valid JSON field
"userRapport" REAL NOT NULL DEFAULT 0
);
-- Add userRapport column if it doesn't exist (using correct SQLite syntax)
SELECT CASE
WHEN NOT EXISTS(SELECT 1 FROM pragma_table_info('accounts') WHERE name='userRapport')
THEN 'ALTER TABLE accounts ADD COLUMN "userRapport" REAL NOT NULL DEFAULT 0;'
END
WHERE NOT EXISTS(SELECT 1 FROM pragma_table_info('accounts') WHERE name='userRapport');
-- Table: memories
CREATE TABLE IF NOT EXISTS "memories" (
"id" TEXT PRIMARY KEY,
Expand Down

0 comments on commit bceed3e

Please sign in to comment.