This profile example is missing the better approach: avoid the dependency of creating the user before creating the profile.
Create the profile with a generated uuid. Once that succeeds, then create the user with the same uuid.
If you build a system that allows orphaned profiles (by just ignoring them) then you avoid the need to deal with potentially missing profiles.
This is essentially implementing MVCC. Write all your data with a new version and then as a final step write to a ledger declaring the new version to be valid. In this case, creating the user is writing to that ledger.
Create the profile with a generated uuid. Once that succeeds, then create the user with the same uuid.
If you build a system that allows orphaned profiles (by just ignoring them) then you avoid the need to deal with potentially missing profiles.
This is essentially implementing MVCC. Write all your data with a new version and then as a final step write to a ledger declaring the new version to be valid. In this case, creating the user is writing to that ledger.