Automate sequence number migration

Hello, my system generates data using the UniqueNumbersAPI. I occasionally migrate data to a new environment by exporting and then importing JSON data (like EntityInspector but automated).

The problem is that when I run my job to import data into the new environment, the last sequence number used for each domain does not come across. So when I attempt generating new data in the new environment, I get duplicate key errors.

Although I am using MySQL, which has a table associated with sequence numbers, there is no entity associated with sequence numbers, so it seems this JSON approach cannot be used. Finally, here comes the question… Is there any way to automate the migration of sequence numbers? Thanks.

Hi, @Keith

There are getCurrentNumber() and setCurrentNumber() method in the UniqueNumbersAPI bean which is available in the core module. So you can read current sequence values on export and write before import.