Skip to content

Feature proposal: Add method to check if migrations are required #359

Open
@iceman91176

Description

@iceman91176

Why ?

When performing re-indexing with our-evolution-scripts we have to be sure that no write-access happens while reindexing (because we write to the index-alias, which still points to the old index) Only after successful re-indexing we change the alias to new new index. Now it is save to start writing again.

To accomplish this we have added a functionality for our multi-instance environment that stops all writing on all instances before executing the evolution, and starts it again after the evolution has been completed. The schema evolutinon is triggered on application start.

But we have to do this even if no evolution will be performed because all scripts have been run already. It would be great to be able to detect if any migration is necessary - and if so perform some action, or just do nothing.

Proposal

I've seen that the current MigrationServiceImpl has a getPendingScriptsToBeExecuted Method that could help here

List<ParsedMigrationScript> getPendingScriptsToBeExecuted(Collection<ParsedMigrationScript> migrationScripts) {

The most simple solution would be to expose a migrationsRequired method that returns true or false by checking the result of getPendingScriptsToBeExecuted

If you accept the general idea and the implementation proposal, I would be happy to provide a PR for this :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions