feat: 添加路径收藏功能

This commit is contained in:
Baobhan Sith
2025-05-23 18:47:04 +08:00
parent f8282fe9c0
commit ae60e0c398
15 changed files with 1269 additions and 7 deletions
@@ -265,6 +265,24 @@ const definedMigrations: Migration[] = [
timestamp INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
);
`
},
{
id: 8,
name: 'Create favorite_paths table',
check: async (db: Database): Promise<boolean> => {
const tableAlreadyExists = await tableExists(db, 'favorite_paths');
return !tableAlreadyExists; // Only run if the table does NOT exist
},
sql: `
CREATE TABLE IF NOT EXISTS favorite_paths (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NULL,
path TEXT NOT NULL,
last_used_at INTEGER NULL;
created_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
updated_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
);
`
}
];
@@ -74,6 +74,7 @@ export const tableDefinitions: TableDefinition[] = [
{ name: 'command_history', sql: schemaSql.createCommandHistoryTableSQL },
{ name: 'path_history', sql: schemaSql.createPathHistoryTableSQL },
{ name: 'quick_commands', sql: schemaSql.createQuickCommandsTableSQL },
{ name: 'favorite_paths', sql: schemaSql.createFavoritePathsTableSQL }, // Added Favorite Paths table
// Appearance related tables (often depend on others or have init logic)
{
+10
View File
@@ -239,4 +239,14 @@ CREATE TABLE IF NOT EXISTS appearance_settings (
created_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
updated_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
);
`;
export const createFavoritePathsTableSQL = `
CREATE TABLE IF NOT EXISTS favorite_paths (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NULL,
path TEXT NOT NULL,
last_used_at INTEGER NULL,
created_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
updated_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
);
`;