Replies: 1 comment 1 reply
-
The proposed solution might work for smaller datasets but if you're migrating lots of streams this might not be the ideal approach. Something like this: storeOptions.Events.MergeTenants("SourceTenantId", "DestinationTenantId"); The resulting WHERE clause for any query to either tenant would be: WHERE tenant_id IN ('SourceTenantId', 'DestinationTenantId') |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I work for a company FooBar. FooBar has 3 departments
Department1
Department2
Department3
They all have to create
Foo
.Foo
is a SingleStreamAggregation that is multitenanted. It has the usual events:FooCreatedDomainEvent
FooUpdatedDomainEvent
Foo....
All is good, departments can't view each other's
Foo
data, but there's still the possibility for certain cross tenant business logic.Now the higherups have decided they need to get rid of
Department1
. They want to fuseDepartment1
withDepartment3
.This means that all
Foo
data needs to be transferred toDepartment3
with the history of events being intact.I would like to suggest the following:
Perhaps even provide a bulk action method?
This method will take the events and stream records of streamid
fooToMigrate.Id
, migrate it to the new tenant and based on projection type maybe even rebuild theFoo
document projection offooToMigrate.Id
.There's ofcourse still the issue of the event being used in other projections and what to do with those.
Imho I think it's a business decision to make sure these projections are also migrated to the correct tenant.
It would also be nice to link this to an event for example a
FooMigratedDomainEvent: IMigrationTrigger
, this way we can also add it as an event to the stream itself.I would like to start a discussion regarding the possible issues and solutions to this. I think it's a relevant enough feature that may occur in real life.
The following is a hacky DO ON YOUR OWN RISK work around on migrating streams to another tenant. Only for
TenancyStyle.Conjoined
YOU HAVE BEEN WARNED!
Beta Was this translation helpful? Give feedback.
All reactions