From d21b04f6d67aa560d109c7b74cce2db0aac0e8d2 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Sun, 23 Oct 2022 20:45:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=BC=93=E5=AD=98=E7=B4=A2?= =?UTF-8?q?=E5=BC=95=E8=A1=A8=E5=8F=96=E6=B6=88UNIQUE=E7=B4=A2=E5=BC=95?= =?UTF-8?q?=EF=BC=8C=E5=B0=BD=E5=8F=AF=E8=83=BD=E9=81=BF=E5=85=8D=20sqlite?= =?UTF-8?q?=20malformed=20=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/caches/list_file_db.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/caches/list_file_db.go b/internal/caches/list_file_db.go index a371849..dc7bae3 100644 --- a/internal/caches/list_file_db.go +++ b/internal/caches/list_file_db.go @@ -473,6 +473,7 @@ func (this *FileListDB) initTables(times int) error { { // expiredAt - 过期时间,用来判断有无过期 // staleAt - 过时缓存最大时间,用来清理缓存 + // 不对 hash 增加 unique 参数,是尽可能避免产生 malformed 错误 _, err := this.writeDB.Exec(`CREATE TABLE IF NOT EXISTS "` + this.itemsTableName + `" ( "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "hash" varchar(32), @@ -498,7 +499,7 @@ ON "` + this.itemsTableName + `" ( "staleAt" ASC ); -CREATE UNIQUE INDEX IF NOT EXISTS "hash" +CREATE INDEX IF NOT EXISTS "hash" ON "` + this.itemsTableName + `" ( "hash" ASC );