What I want to do is for every customer add a property named orders
with the datatype array<Order>[]
and move all Orders
associated with a Customer
into this property. In the target entity type and then delete the redundant property orders.person id afterwards.
I have done this so far:
MERGE INTO `Customers` AS cust
USING `Orders` AS ord ON cust.id = ord.personId
WHEN MATCHED THEN
UPDATE
SET cust.orders = {"order_id": ord.id, "person_id": ord.person_id, "total_price": ord.total_price}
WHERE cust.id = ord.PersonId