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

refactor: EXPOSED-454 add execute alter statements log on createMissingTablesAndColumns function #2166

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ object SchemaUtils {
addMissingColumnsStatements(tables = tables, withLogs)
}
logTimeSpent("Executing alter table statements", withLogs) {
alterStatements.forEach { exposedLogger.info("Alter table statements to execute - $it") }
Copy link
Collaborator

Choose a reason for hiding this comment

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

This would print "Alter table statements to execute" next to each ALTER statement.

You could also call addLogger(StdOutSqlLogger) in your transaction before calling SchemaUtils.createMissingTablesAndColumns and that would log the ALTER statements (and all other SQL statements being executed). How about doing that instead of this?

Copy link
Author

@hungrytech hungrytech Jul 26, 2024

Choose a reason for hiding this comment

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

@joc-a
Thank you for the review.
As you mentioned, developers need to be aware that they must include addLogger(StdOutSqlLogger) in the transaction block. Since the ALTER command modifies the table, how about logging based on the value of the withLogs flag?

execStatements(inBatch, alterStatements)
commit()
}
Expand Down