You have table A and table B in your SQL data model, with table A having a foreign key towards table B. You now want to migrate your CRUD architecture to CQRS. Imagine the following scenario:
- You receive a command to persist a new entry of A
- You write to your append log and process it updating your state
- The read side picks it up and fail to insert in the database
In this situation, your write side and read side will never reach consistency. How do you handle read-side constraints in CQRS? Should validation occurs in the write side instead?