This issue is fairly similar to #52.
How to reproduce the bug
- Init migrations on new environments called
environment1 and environment2 using content storage as a method to track migrations. You can use a source environment to duplicate from for both of the environments if you want.
- Create a migration and apply it to
environment1.
- Run
npx migrations content --verbose --diff --source-environment-id environment1 --dest-environment-id environment2
- You should see an error like this one:
Different migration states detected. environment1 (1682093148544) !== environment2 (-Infinity)
Explanation of the issue
While the ID of the migration in environment1 is accurate (1682093148544), the ID of the migration in environment2 isn't (-Infinity) and is the outcome of this line of code:
|
return Math.max(...versions); |
Since environment2 doesn't have any migration, doing Math.max() on it results in -Infinity. The command then compares -Infinity to 1682093148544, which doesn't make much sense.
Suggestions on how to solve the issue
- If no migration is found in one of the environments, relay that information to the user and abort the process. The upside is that it helps make sense of the issue to the user. I'm not sure if there is a downside to this.