mirror of
				https://github.com/TeaOSLab/EdgeNode.git
				synced 2025-11-04 16:00:25 +08:00 
			
		
		
		
	文件缓存索引表取消UNIQUE索引,尽可能避免 sqlite malformed 错误
This commit is contained in:
		@@ -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
 | 
			
		||||
);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user