feat: update schema synchronization note and add device fields to refresh_tokens and devices tables

This commit is contained in:
shuaiplus
2026-05-07 19:49:38 +08:00
parent c6c8979772
commit 33f7c5d88a
+5 -1
View File
@@ -1,7 +1,7 @@
PRAGMA foreign_keys = ON; PRAGMA foreign_keys = ON;
-- IMPORTANT: -- IMPORTANT:
-- Keep this file in sync with src/services/storage.ts (SCHEMA_STATEMENTS). -- Keep this file in sync with src/services/storage-schema.ts (SCHEMA_STATEMENTS).
-- Any new table/column/index must be added to both places together. -- Any new table/column/index must be added to both places together.
CREATE TABLE IF NOT EXISTS config ( CREATE TABLE IF NOT EXISTS config (
@@ -124,6 +124,8 @@ CREATE TABLE IF NOT EXISTS refresh_tokens (
token TEXT PRIMARY KEY, token TEXT PRIMARY KEY,
user_id TEXT NOT NULL, user_id TEXT NOT NULL,
expires_at INTEGER NOT NULL, expires_at INTEGER NOT NULL,
device_identifier TEXT,
device_session_stamp TEXT,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
); );
CREATE INDEX IF NOT EXISTS idx_refresh_tokens_user ON refresh_tokens(user_id); CREATE INDEX IF NOT EXISTS idx_refresh_tokens_user ON refresh_tokens(user_id);
@@ -164,6 +166,8 @@ CREATE TABLE IF NOT EXISTS devices (
encrypted_user_key TEXT, encrypted_user_key TEXT,
encrypted_public_key TEXT, encrypted_public_key TEXT,
encrypted_private_key TEXT, encrypted_private_key TEXT,
banned INTEGER NOT NULL DEFAULT 0,
banned_at TEXT,
device_note TEXT, device_note TEXT,
last_seen_at TEXT, last_seen_at TEXT,
created_at TEXT NOT NULL, created_at TEXT NOT NULL,