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

Conversation

hungrytech
Copy link

@hungrytech hungrytech commented Jul 20, 2024

EXPOSED-454

  • add alter table statements log on createMissingTablesAndColumns function

@hungrytech hungrytech changed the title refactor: add execute alter table ddl log on createMissingTablesAndColumns function refactor: EXPOSED-454 add execute alter table ddl log on createMissingTablesAndColumns function Jul 20, 2024
@hungrytech hungrytech changed the title refactor: EXPOSED-454 add execute alter table ddl log on createMissingTablesAndColumns function refactor: EXPOSED-454 add execute alter statements log log on createMissingTablesAndColumns function Jul 20, 2024
@hungrytech hungrytech changed the title refactor: EXPOSED-454 add execute alter statements log log on createMissingTablesAndColumns function refactor: EXPOSED-454 add execute alter statements log on createMissingTablesAndColumns function Jul 20, 2024
@hungrytech hungrytech force-pushed the add-logging-on-alterstatement branch from d51639f to ffbc611 Compare July 20, 2024 08:04
@injae-kim
Copy link

Fix #800 issue

@@ -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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants