In a microservice architechture with each microserice having it's own database, what is the recommended way of creating a one-to-many relationship between two microservices?
In my case I have two tables:
products
CREATE TABLE IF NOT EXISTS product.products (
"id" UUID DEFAULT uuid_generate_v4(),
...
)
collections
CREATE TABLE IF NOT EXISTS collection.collections (
"id" UUID DEFAULT uuid_generate_v4(),
...
)
What is recomennded between the following options?
- a)
productshas field"collection" UUID - b)
collectionshas field"products" UUID[] - c) both
Or is there another answer which better suits my use case, and if so, why?