From b21e2a902165e90c7c6502c35c4ed286b80cf67e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9B=AE=E6=A3=83?= Date: Tue, 27 Feb 2024 13:58:12 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=94=20=E8=B0=83=E6=95=B4=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E6=A3=80=E6=B5=8B=EF=BC=8C=E4=B8=BA=E5=90=8E?= =?UTF-8?q?=E7=BB=AD=E5=8F=AF=E8=83=BD=E7=9A=84=E6=96=B0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E5=81=9A=E5=87=86=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/Sqlite/index.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/plugins/Sqlite/index.ts b/src/plugins/Sqlite/index.ts index 1f9ae2da..26b79594 100644 --- a/src/plugins/Sqlite/index.ts +++ b/src/plugins/Sqlite/index.ts @@ -1,7 +1,7 @@ /** * @file plugins/Sqlite/index.ts * @description Sqlite 数据库操作类 - * @since Beta v0.4.1 + * @since Beta v0.4.4 */ import { app } from "@tauri-apps/api"; @@ -173,19 +173,17 @@ class Sqlite { /** * @description 检测数据库完整性 - * @since Beta v0.3.3 + * @since Beta v0.4.4 * @returns {Promise} */ public async check(): Promise { const db = await this.getDB(); let isVerified = false; - // 检测数据表是否都存在 const sqlT = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;"; const res: Array<{ name: string }> = await db.select(sqlT); - if (res.length === this.tables.length) { - if (this.tables.every((item) => res.map((i) => i.name).includes(item))) { - isVerified = true; - } + // 只检测已有的表是否具备,不检测总表数目 + if (this.tables.every((item) => res.map((i) => i.name).includes(item))) { + isVerified = true; } return isVerified; }