原始 PostgreSQL模式通过一对一关系表示各方。party 表保存所有参与方的共同属性,而其他表则存储每个参与方类别的特定信息。这些差异导致每个类的字段不同,从而迫使 PostgreSQL 等表格模式创建新表。
您可以通过为关系数据库中的每个表添加映射,将此信息嵌入到单个MongoDB party文档中。
参与方包括以下关键实体:
下图显示了参与方域的实体关系图 (ERD):
单击 Mappings from relational tables 旁边的 Add。单击 Embedded documents,然后从 Source table 下拉菜单中选择 person。
单击 Save and close 后,对 organization 和 grouping 源表重复此进程。
单击 Mappings from relational tables 旁边的 Add。由于一方可以有多个位置地址,因此选择 Embedded array。从 Source table 下拉菜单中选择 party_location_address。
在 All fields 复选框下,取消选中 partyIdentifier字段,然后单击 Save and close。
要将解决信息包含在 party_location_address集合中,请单击 Add 并选择 Embedded documents。从 Source table 下拉菜单中选择 location_address。
在 Advanced settings 下,单击 Merge fields into the parent 复选框。此选项可确保文档没有不必要的嵌套字段。
单击 Save and close(连接)。
将所有必要的表映射到 party集合后,您就可以从Relational Migrator的MongoDB视图中删除以下集合:
person
organization
grouping
partyLocationAddress
重要
不要删除locationAddress集合,因为它仍然与 insurable_object 表具有现有关系,我们将在稍后的步骤中向该表添加映射规则。
您的模式
映射“参与方”域后,您可以重构“策略”域。请参阅重构策略域。