Skip to content

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

Open
hungrytech wants to merge 1 commit intoJetBrains:mainfrom
hungrytech:add-logging-on-alterstatement
Open

refactor: EXPOSED-454 add execute alter statements log on createMissingTablesAndColumns function#2166
hungrytech wants to merge 1 commit intoJetBrains:mainfrom
hungrytech:add-logging-on-alterstatement

Conversation

@hungrytech
Copy link
Copy Markdown

@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
Copy Markdown

Fix #800 issue

addMissingColumnsStatements(tables = tables, withLogs)
}
logTimeSpent("Executing alter table statements", withLogs) {
alterStatements.forEach { exposedLogger.info("Alter table statements to execute - $it") }
Copy link
Copy Markdown
Contributor

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
Copy Markdown
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