From d62c26bee3edd273e59750a98b81c79f7b154e92 Mon Sep 17 00:00:00 2001 From: Phoenix <64720302+Concur-max@users.noreply.github.com> Date: Mon, 30 Jun 2025 16:18:53 +0800 Subject: [PATCH] =?UTF-8?q?refactor(db):=20=E6=B8=85=E7=90=86=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E5=88=9D=E5=A7=8B=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E5=86=97=E4=BD=99=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除db.js中不必要的注释和空行,保持代码简洁 --- src/utils/db.js | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/utils/db.js b/src/utils/db.js index 42db0ca..38f932c 100644 --- a/src/utils/db.js +++ b/src/utils/db.js @@ -1,28 +1,21 @@ -// src/db.js + import Dexie from 'dexie'; -// 创建数据库实例 export const db = new Dexie('chatHistory'); // 定义数据库结构 db.version(2).stores({ - // 表名: 索引字段列表 - // ++id 表示自增主键 - // name, age 表示这些字段将被索引 -// friends: '++id, name, age', - + // 聊天记录表 - // 为常用查询字段创建索引 + messages: 'msg_id, sequence, talk_type, msg_type, user_id, receiver_id, is_read, created_at', // 会话表(包含私聊和群聊) - // 为常用查询字段创建索引 conversations: 'id, talk_type, receiver_id, index_name, updated_at, unread_num' }); -// 数据库升级处理 db.on('ready', function() { - // 检查是否需要从服务器同步数据 + console.log('数据库已就绪,版本:', db.verno); });