feat: 创建索引,优化D1数据库查询速度

This commit is contained in:
nap0o committed 2026-03-03 19:21:05 +08:00
1 parent 57f763888b
commit e089d710a1
1 file changed
+3 -1
+3 -1
View File
@@ -31,8 +31,10 @@ CREATE TABLE IF NOT EXISTS backup_providers (
);
-- 索引
CREATE INDEX IF NOT EXISTS idx_vault_service ON vault(service);
DROP INDEX IF EXISTS idx_vault_service;
CREATE INDEX IF NOT EXISTS idx_vault_created_at ON vault(created_at DESC);
CREATE INDEX IF NOT EXISTS idx_backup_providers_type ON backup_providers(type);
CREATE INDEX IF NOT EXISTS idx_vault_service_created_at ON vault(service, created_at DESC);
-- Remove any existing duplicates before enforcing unique constraint; keep the earliest
DELETE FROM vault