switch_branch()
function switch_branch(adapter, options): Promise<void>;
Defined in: packages/rxdb-adapter-sqlite-core/src/version/switch_branch.ts:110
切换当前活跃分支并应用所需的数据迁移。
整个流程在单事务内完成:移除触发器 → 数据迁移 → 更新 RxDBChange 序列 → 重建触发器 + 更新 activated 标志,保证原子性;事件在提交成功后派发。
Parameters
| Parameter | Type | Description |
|---|---|---|
adapter | RxDBAdapterSqliteBase | SQLite 适配器 |
options | SwitchBranchOptions | 包含目标 branchId 与可选的 SwitchVersionActions |
Returns
Promise<void>
Throws
任意事务内 SQL 错误(触发回滚)