feat: 添加历史路径功能

This commit is contained in:
Baobhan Sith
2025-05-23 15:58:26 +08:00
parent d8f0524b7c
commit f8282fe9c0
14 changed files with 787 additions and 42 deletions
+16 -2
View File
@@ -227,13 +227,12 @@ const definedMigrations: Migration[] = [
ANALYZE; -- 重新分析数据库模式
`
},
// --- 未来可以添加更多迁移 ---
{
id: 6,
name: 'Create passkeys table for WebAuthn credentials',
check: async (db: Database): Promise<boolean> => {
const passkeysTableAlreadyExists = await tableExists(db, 'passkeys');
return !passkeysTableAlreadyExists; // Only run if the table does NOT exist
return !passkeysTableAlreadyExists;
},
sql: `
CREATE TABLE IF NOT EXISTS passkeys (
@@ -251,6 +250,21 @@ const definedMigrations: Migration[] = [
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);
`
},
{
id: 7,
name: 'Create path_history table',
check: async (db: Database): Promise<boolean> => {
const tableAlreadyExists = await tableExists(db, 'path_history');
return !tableAlreadyExists;
},
sql: `
CREATE TABLE IF NOT EXISTS path_history (
id INTEGER PRIMARY KEY AUTOINCREMENT,
path TEXT NOT NULL,
timestamp INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
);
`
}
];