fix: 修复 transaction 表名与 Dexie 内置方法冲突(导出 JSON 与记账失效)
This commit is contained in:
@@ -35,13 +35,13 @@ function rowHash(row: AnyRow): string {
|
||||
}
|
||||
|
||||
async function getTable(name: string): Promise<AnyRow[]> {
|
||||
return (db as unknown as AnyRow)[name].toArray()
|
||||
return db.table(name).toArray()
|
||||
}
|
||||
|
||||
// 一次性补齐 uuid 与 updated_at,缺失时回填
|
||||
async function ensureSyncFields(): Promise<void> {
|
||||
for (const t of TABLES) {
|
||||
const table = (db as unknown as AnyRow)[t]
|
||||
const table = db.table(t)
|
||||
const rows: AnyRow[] = await table.toArray()
|
||||
for (const row of rows) {
|
||||
if (t === 'setting' && EXCLUDE_SETTING_KEYS.has(row.key)) continue
|
||||
@@ -287,7 +287,7 @@ async function doRunSync(config: SyncConfig): Promise<SyncResult> {
|
||||
const finalMirror: { table: string; uuid: string; hash: string }[] = []
|
||||
|
||||
for (const t of TABLES) {
|
||||
const table = (db as unknown as AnyRow)[t]
|
||||
const table = db.table(t)
|
||||
const localRows: AnyRow[] = await table.toArray()
|
||||
const byUuid = new Map<string, AnyRow>()
|
||||
for (const row of localRows) byUuid.set(row.uuid, row)
|
||||
|
||||
Reference in New Issue
Block a user