feat: 添加路径收藏功能
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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'))
|
||||
);
|
||||
`;
|
||||
Reference in New Issue
Block a user