"seeding" a simple system being migrated to CQRS

Hi, I’ve an existing system that I want to migrate to ES/CQRS. I’ve an existing table that would end up being a view/projection. So I’m trying to decide the best way to get the current data migrated. I’ve been considering a job/script that would simply read a copy of the existing data and issue a set of “CreateEntity” commands, the same command the the migrated app would use in the normal course of operation to create an instance of the aggregate in question. Is this a good approach ?

How would your aggregate root look like in relation to these entities ? Is the existing system already ddd ?


In this case there’s basically a single entity/table that would pretty much map 1 to 1 as an aggregate. The system isn’t DDD but I’m in the process of migrating it. It’s super simple at the moment, so this current entity that I want to make an aggregate is basically the only thing that needs to change at the moment.

Creating aggregates based on the current state in the database us really the only thing you can do.
You can consider implementing them as Import commands, which aren’t used anymore after the initial data import, or translate each row in the existing table to one or more commands that make sense in the new system design.