mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-05-17 01:22:45 +00:00
refactor(backend): move db repos to typescript and update imports
This commit is contained in:
@@ -1,5 +1,14 @@
|
||||
import { Database } from "better-sqlite3";
|
||||
import { APP_CONFIG_TABLE_SCHEMA_SQL, LAST_SCANNED_AT_SQL, SESSIONS_TABLE_SCHEMA_SQL, WORK_SPACE_PATH_SQL } from "@/shared/database/schema.js";
|
||||
import {
|
||||
APP_CONFIG_TABLE_SCHEMA_SQL,
|
||||
LAST_SCANNED_AT_SQL,
|
||||
PUSH_SUBSCRIPTIONS_TABLE_SCHEMA_SQL,
|
||||
SESSION_NAMES_TABLE_SCHEMA_SQL,
|
||||
SESSIONS_TABLE_SCHEMA_SQL,
|
||||
USER_NOTIFICATION_PREFERENCES_TABLE_SCHEMA_SQL,
|
||||
VAPID_KEYS_TABLE_SCHEMA_SQL,
|
||||
WORK_SPACE_PATH_SQL
|
||||
} from "@/shared/database/schema.js";
|
||||
import { logger } from "@/shared/utils/logger.js";
|
||||
|
||||
const addColumnToTableIfNotExists = (
|
||||
@@ -30,6 +39,16 @@ export const runMigrations = (db: Database) => {
|
||||
// Create app_config table if it doesn't exist (for existing installations)
|
||||
db.exec(APP_CONFIG_TABLE_SCHEMA_SQL);
|
||||
|
||||
// Create notification and push tables if they don't exist (for existing installations)
|
||||
db.exec(USER_NOTIFICATION_PREFERENCES_TABLE_SCHEMA_SQL);
|
||||
db.exec(VAPID_KEYS_TABLE_SCHEMA_SQL);
|
||||
db.exec(PUSH_SUBSCRIPTIONS_TABLE_SCHEMA_SQL);
|
||||
db.exec("CREATE INDEX IF NOT EXISTS idx_push_subscriptions_user_id ON push_subscriptions(user_id)");
|
||||
|
||||
// Create session_names table if it doesn't exist (for existing installations)
|
||||
db.exec(SESSION_NAMES_TABLE_SCHEMA_SQL);
|
||||
db.exec("CREATE INDEX IF NOT EXISTS idx_session_names_lookup ON session_names(session_id, provider)");
|
||||
|
||||
// Create sessions table if it doesn't exist (for existing installations)
|
||||
db.exec(SESSIONS_TABLE_SCHEMA_SQL);
|
||||
db.exec(
|
||||
|
||||
Reference in New Issue
Block a user