@Override
    public void upgrade() {
        if (shouldSkip()) {
            return;
        }

        final ImmutableSet<String> eventIndexPrefixes = ImmutableSet.of(
                elasticsearchConfig.getDefaultEventsIndexPrefix(),
                elasticsearchConfig.getDefaultSystemEventsIndexPrefix());

        elasticsearch.addGl2MessageIdFieldAlias(eventIndexPrefixes);

        writeMigrationCompleted(eventIndexPrefixes);
    }
@Test
    void doesNotRunIfMigrationHasCompletedBefore() {
        when(clusterConfigService.get(V20200730000000_AddGl2MessageIdFieldAliasForEvents.MigrationCompleted.class))
                .thenReturn(V20200730000000_AddGl2MessageIdFieldAliasForEvents.MigrationCompleted.create(ImmutableSet.of()));

        this.sut.upgrade();

        verify(elasticsearchAdapter, never()).addGl2MessageIdFieldAlias(any());
    }