# Automate Instance Migrations

**URL:** <https://forum.flowable.org/t/automate-instance-migrations/11456>\
**Category:** Flowable Engine\
**Created:** [April 23, 2024, 12:30pm UTC](https://forum.flowable.org/t/automate-instance-migrations/11456 "2024-04-23T12:30:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![x2012x](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/x2012x/32/3292_2.png) [@x2012x](https://forum.flowable.org/u/x2012x)\
**Post date:** [April 23, 2024, 12:30pm UTC](https://forum.flowable.org/t/automate-instance-migrations/11456/1 "2024-04-23T12:30:02Z")

</div>

What techniques are people using to manage the execution of instance migrations?

My solution is already setup to leverage Flowable’s automatic deployment of model definitions at server startup. But, I’d also like to automatically migrate any live case instances to the latest model definitions. I am aware of the CMMN migration service and the REST endpoints for executing migrations but I haven’t found a Flowable provided mechanism to manage migrations and automate their execution at startup.

I have been exploring building my own solution to automate migrations, perhaps leveraging a Spring event listener (e.g. `@EventListener(ApplicationReadyEvent::class)`) but would prefer not to reinvent the wheel if the capability already exists.

---

<div class="post-metadata">

**Author:** ![martin.grofcik](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/martin.grofcik/32/71_2.png) [@martin.grofcik](https://forum.flowable.org/u/martin.grofcik)\
**Post date:** [April 23, 2024, 2:25pm UTC](https://forum.flowable.org/t/automate-instance-migrations/11456/2 "2024-04-23T14:25:45Z")

</div>

Let’s say you have timer start event (triggered 1 min after the deployment). The process can fetch all case/process instances to migrate and migrate instances accordingly.

Regards  
Martin

---

<div class="post-metadata">

**Author:** ![qingyumonian](https://avatars.discourse-cdn.com/v4/letter/q/77aa72/32.png) [@qingyumonian](https://forum.flowable.org/u/qingyumonian)\
**Post date:** [May 9, 2024, 8:59am UTC](https://forum.flowable.org/t/automate-instance-migrations/11456/3 "2024-05-09T08:59:41Z")

</div>

As for what you said above, could you please post the location of the code? I would like to know the relevant process.  
looking forward to your reply

---

<div class="post-metadata">

**Author:** ![x2012x](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/x2012x/32/3292_2.png) [@x2012x](https://forum.flowable.org/u/x2012x)\
**Post date:** [May 9, 2024, 12:33pm UTC](https://forum.flowable.org/t/automate-instance-migrations/11456/4 "2024-05-09T12:33:56Z")

</div>

@martin.grofcik, thanks for the suggestion. I ended up leveraging a Spring event listener (e.g. `@EventListener(ApplicationReadyEvent::class)` ) as the trigger to kick-off the migrations. Seems to be working well so far.
