Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The select statement is executed by queryTx and will not be printed. The logs you see are all printed by Trace. https://github.com/go-gorm/gorm/blob/master/migrator/migrator.go#L122
In fact, I don't agree with using
fmt.Println
here. It is equivalent to searching for the record I need in a lot of logs, and it may be inconsistent with the output of the original log settings, and level control cannot be used.I think we can provide log implementation for migration through documentation, such as writing the change log to a file through the log.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
postgresql dry run mode still need to run many select method and will printout by this method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gorm/migrator/migrator.go
Lines 112 to 114 in 3e2c4fc