refactor: improved db performance

This commit is contained in:
2025-11-19 22:34:32 +05:30
parent 45cfdc00de
commit bb0afcd703
2 changed files with 77 additions and 214 deletions

View File

@@ -148,5 +148,16 @@ pub fn get_migrations() -> Vec<Migration> {
END;
",
kind: MigrationKind::Up,
},
Migration {
version: 3,
description: "add_performance_indexes",
sql: "
CREATE INDEX IF NOT EXISTS idx_downloads_video_id ON downloads(video_id);
CREATE INDEX IF NOT EXISTS idx_downloads_playlist_id ON downloads(playlist_id);
CREATE INDEX IF NOT EXISTS idx_downloads_status_updated ON downloads(download_status, updated_at DESC);
CREATE INDEX IF NOT EXISTS idx_downloads_id_desc ON downloads(id DESC);
",
kind: MigrationKind::Up,
}]
}