研究了Dexie documentation on versioning之后,我不清楚使用Dexie 3.0.1进行版本控制的某些方面。
假设我有table1
和table2
,其中只有id
作为数据库1版本的索引:
db.version(1).stores({table1: "++id", table2: "++id"});
对于数据库的第2版,我将shoeSize
添加为table1
的索引:
db.version(2).stores({table1: "++id,shoeSize"});
对于数据库的第3版,我将dateOfBirth
添加为table2
的索引。
db.version(3).stores({table2: "++id,dateOfBirth"});
如果我正确理解,对于Dexie 3.0,我的最终代码应该只对stores
:db.version(3).stores({table2: "++id,dateOfBirth"});
作最后更改。它将没有版本2:db.version(2).stores({table1: "++id,shoeSize"});
。
因此,如果用户安装了我的应用程序的版本1,然后直接升级到版本3,那么他的table1
将如何更新为具有shoeSize
索引?我应该如何使用Dexie 3.0处理多个表的版本控制?