Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output changeset execution to UI like rollback does #1932

Merged
merged 3 commits into from Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -46,7 +46,7 @@ public Direction getDirection() {
public void visit(ChangeSet changeSet, DatabaseChangeLog databaseChangeLog, Database database, Set<ChangeSetFilterResult> filterResults) throws LiquibaseException {
Executor executor = Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", database);
if (! (executor instanceof LoggingExecutor)) {
Scope.getCurrentScope().getUI().sendMessage("Rolling Back Changeset:" + changeSet);
Scope.getCurrentScope().getUI().sendMessage("Rolling Back Changeset: " + changeSet);
}
sendRollbackWillRunEvent(changeSet, databaseChangeLog, database);
try {
Expand Down
Expand Up @@ -10,6 +10,9 @@
import liquibase.database.ObjectQuotingStrategy;
import liquibase.exception.LiquibaseException;
import liquibase.exception.MigrationFailedException;
import liquibase.executor.Executor;
import liquibase.executor.ExecutorService;
import liquibase.executor.LoggingExecutor;

import java.util.Set;

Expand Down Expand Up @@ -40,8 +43,12 @@ public Direction getDirection() {
@Override
public void visit(ChangeSet changeSet, DatabaseChangeLog databaseChangeLog, Database database,
Set<ChangeSetFilterResult> filterResults) throws LiquibaseException {
Executor executor = Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", database);
if (! (executor instanceof LoggingExecutor)) {
Scope.getCurrentScope().getUI().sendMessage("Running Changeset: " + changeSet);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this logs directly to stdout or it should respect logging levels? On what level it logs then? I have logging.level.liquibase: WARN (in Spring Boot's application.properties) and after update I see all these messages in console as-is, without date/level/class/etc. For example:

2022-01-22 15:02:34.380 [user:  ]  INFO 18949 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
Running Changeset: liquibase/initial-state.xml::create-users_activation-table::php-coder
Running Changeset: liquibase/initial-state.xml::create-users_table::php-coder
Running Changeset: liquibase/initial-state.xml::create-countries-table::php-coder
...

Copy link

@php-coder php-coder Jan 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be related to my dated Spring Boot version, so I'm not fully sure whether it's a bug in Liquibase..

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional observation: these messages appears also when I run unit tests that use H2 :-/

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree on this one. We have a few hundreds of change logs and thousands of tests. Imagine how messy build logs are now.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
ChangeSet.RunStatus runStatus = this.database.getRunStatus(changeSet);
Scope.getCurrentScope().getLog(getClass()).fine("Running Changeset:" + changeSet);
Scope.getCurrentScope().getLog(getClass()).fine("Running Changeset: " + changeSet);
fireWillRun(changeSet, databaseChangeLog, database, runStatus);
ExecType execType = null;
ObjectQuotingStrategy previousStr = this.database.getObjectQuotingStrategy();
Expand Down