How to migrate from legacy relational database to Axon server event store

Hello folks, I have to migrate data from previous legacy relational database (MySQL) to Axon server event store. My first idea is to treat the old data as a snapshot of events and save it to the event store. So if you have data of a user like this.

| user-id | first_name | last_name | date_of_birth |
| 123.     | Jonh          | Doe.          | 1991-02-01.   |

I will create a migration script to pull data from mysql and save it to the event store like this

    List<User> users = // pull data from mysql
    foreach(User user: users) {
          type = UserCreatedEvent::class.simpleName,
          aggregateIdentifier = user.getUserId(),
          sequenceNumber = 0, // start migration
          payload =new UserCreatedEvent(user)))

what do u guys think or any better solutions

Well, I guess it depends on what the purpose for your migration is. If you just want to migrate data from one store to another, converting each row into a xxxCreatedEvent and publishing it to the event store seems to be the straight forward approach.

On the other hand, it might be recommended to keep the purpose of the migration in mind and verify if a straight forward migration of the data is the only thing you need. My guess is there are some other reasons as well which might be a moment in time to evaluate some design choices of the past. If there is no other reason than migrating data just for the sake of migration, why migrating in the first place? :thinking: