'Advice on resetting Mongock Changesets
We are using Mongock in our spring-boot/kotlin microservices as our main Mongo DB migration tool and it is working perfectly. We started with a simple json file to create a few collections and have been adding changesets for a while now.
By now we have so many changesets that it is becoming hard to see what 'the truth' is about our database. We do not have one single json file or a bunch of files which tells us what the state of the database is, it is an accumulation of the start json and all changesets.
I would like to create a new baseline script based on the current situation and start over. What are some best-practices to achieve this? Of course without losing data etc.
Solution 1:[1]
I believe you are asking two different things. First How to know the current state of the Mongock migrations, and second, How to perform a baseline
- How to know the current state
Mongock offers a cli(currently in beta, although is pretty stable) which offers this.
Simple running ./mongock state db -aj yourApp.jar
Currently it requires passing your application jar, but this dependency will be removed.
More information in the documentation.
- Baseline
Mongock currently doesn't provide this feature in the CLI, but it's one of the next items in our roadmap
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mongock team |
