Skip to content

Commit

Permalink
- When running update-sql, the create and lock SQL is output multiple…
Browse files Browse the repository at this point in the history
… times.

- When running in a headless environment, the lock table gets unlocked because HubService.register() thinks it can prompt when it really can't
  • Loading branch information
nvoxland committed Jan 5, 2022
1 parent 0edf7c0 commit 16756ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import liquibase.exception.UnexpectedLiquibaseException;
import liquibase.executor.Executor;
import liquibase.executor.ExecutorService;
import liquibase.executor.LoggingExecutor;
import liquibase.snapshot.InvalidExampleException;
import liquibase.snapshot.SnapshotGeneratorFactory;
import liquibase.sql.Sql;
Expand Down Expand Up @@ -99,6 +100,14 @@ public void init() throws DatabaseException {
Executor executor = Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", database);

int maxIterations = 10;
if (executor instanceof LoggingExecutor) {
//can't / don't have to re-check
if (hasDatabaseChangeLogLockTable()) {
maxIterations = 0;
} else {
maxIterations = 1;
}
}
for (int i = 0; i < maxIterations; i++) {
try {
if (!hasDatabaseChangeLogLockTable(true)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void setAllowPrompt(boolean allowPrompt) throws IllegalArgumentException

@Override
public boolean getAllowPrompt() {
return allowPrompt;
return getConsole().supportsInput() && allowPrompt;
}

@Override
Expand Down

0 comments on commit 16756ab

Please sign in to comment.