refactor(db): 清理数据库初始化代码中的冗余注释
移除db.js中不必要的注释和空行,保持代码简洁
This commit is contained in:
parent
123bf8051f
commit
d62c26bee3
@ -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);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user