Is there a reason why you used a separate model for ShippingAddress and BillingAddress? Imo it would be better to do it like this:
model Order {
...
shippingAddress Address? @relation(fields: [shippingAddressId], references: [id])
shippingAddressId String?
billingAddress Address? @relation(fields: [billingAddressId], references: [id])
billingAddressId String?
...
}
model Address {
...
}
Is there a reason why you used a separate model for ShippingAddress and BillingAddress? Imo it would be better to do it like this: