Skip to content

Commit

Permalink
Temporary fix dropAll command after command refactoring
Browse files Browse the repository at this point in the history
Fix will be reverted in the scope of DAT-15327
  • Loading branch information
vitaliimak committed Jul 5, 2023
1 parent 0e8faac commit 865565c
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@
import com.mongodb.client.MongoDatabase;
import liquibase.CatalogAndSchema;
import liquibase.Scope;
import liquibase.changelog.ChangeLogHistoryService;
import liquibase.changelog.ChangeLogHistoryServiceFactory;
import liquibase.exception.LiquibaseException;
import liquibase.executor.Executor;
import liquibase.executor.ExecutorService;
import liquibase.ext.mongodb.configuration.MongoConfiguration;
import liquibase.ext.mongodb.statement.DropAllCollectionsStatement;
import liquibase.lockservice.LockService;
import liquibase.lockservice.LockServiceFactory;
import liquibase.nosql.database.AbstractNoSqlDatabase;
import lombok.NoArgsConstructor;
import lombok.Setter;
Expand All @@ -53,6 +56,16 @@ public void dropDatabaseObjects(final CatalogAndSchema schemaToDrop) throws Liqu
final Executor executor = Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor(EXECUTOR_NAME, this);
DropAllCollectionsStatement dropAllCollectionsStatement = new DropAllCollectionsStatement();
executor.execute(dropAllCollectionsStatement);

// TODO Revert this changes in the scope of DAT-15327
LockService lockService = LockServiceFactory.getInstance().getLockService(this);
lockService.releaseLock();
lockService.destroy();
LockServiceFactory.getInstance().resetAll();
ChangeLogHistoryService changeLogService = Scope.getCurrentScope().getSingleton(ChangeLogHistoryServiceFactory.class).getChangeLogService(this);
Scope.getCurrentScope().getSingleton(ChangeLogHistoryServiceFactory.class).unregister(changeLogService);
Scope.getCurrentScope().getSingleton(ChangeLogHistoryServiceFactory.class).resetAll();
Scope.getCurrentScope().getSingleton(ExecutorService.class).reset();
Scope.getCurrentScope().getSingleton(ChangeLogHistoryServiceFactory.class).getChangeLogService(this).destroy();
}

Expand Down

0 comments on commit 865565c

Please sign in to comment.