核心数据映射模型版本哈希值不匹配源模型版本哈希值
在启用Core Data Migration Debug的情况下,执行迁移时,会看到具有已更改哈希值的三个实体(2,3,4)。
With Core Data Migration Debug enabled, when performing a migration I see three entities (2, 3, 4) with changed hashes, as expected. Entity 1 doesn't change and is for illustration.
存储元数据(源模型):
Store metadata (source model):
Entity1 = <67852e01 ...>;
Entity2 = <2b68bba5 ...>;
Entity3 = <58babd8d ...>;
Entity4 = <1c694c80 ...>;
当前模型(目标模型):
Current model (destination model):
Entity1 = <67852e01 ...>;
Entity2 = <260e4d68 ...>;
Entity3 = <13360b6f ...>;
Entity4 = <16513e1b ...>;
接下来,我创建映射模型,但映射模型中的散列与实际模型:
Next, I create the mapping model, but the hashes in the mapping model are different than those in the actual models:
映射模型源Hashes:
Mapping Model Source Hashes:
Entity1 = <67852e01 ...>;
Entity2 = <2b68bba5 ...>;
Entity3 = <d66bed18 ...>; // !!!
Entity4 = <2c56997a ...>; // !!!
映射模型目标散列:
Entity1 = <67852e01 ...>;
Entity2 = <260e4d68 ...>;
Entity3 = <cb08343c ...>; // !!!
Entity4 = <1bc2cf8c ...>; // !!!
使用不同哈希值创建映射模型的原因是什么?我查看了此问题,并尝试更新
What are the reasons the mapping model could be created with different hashes than the actual store's hashes? I looked at this question and tried updating the Mapping Model's models, but it didn't work.
最终工作的解决方案是创建一个新的模型版本删除那些实体,然后创建另一个新模型,并重新引入实体。
The solution that finally worked was to create a new model version in which those entities were removed, then create another new model, with the entities re-introduced.