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
DryRun for migrator #5689
DryRun for migrator #5689
Conversation
migrator/migrator.go
Outdated
execTx := queryTx | ||
if m.DB.DryRun { | ||
queryTx.DryRun = false | ||
execTx = m.DB.Session(&gorm.Session{Logger: &printSQLLogger{}}) |
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 printSQLLogger
should reuse the current logger to print the running SQL?
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 existing logger print some tracing text, so we can not copy the output to execute it.
I think a new logger printSQLLogger
is necessary.
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.
Any other suggestion on this PR? @jinzhu
Any progress on this PR? This would be a great feature! |
What did this pull request do?
Print SQL in AutoMigrate with DryRun option.
User Case Description
As mentioned in #3545.