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

How to print SQL when auto migration? #3545

Closed
yufeiminds opened this issue Sep 28, 2020 · 3 comments
Closed

How to print SQL when auto migration? #3545

yufeiminds opened this issue Sep 28, 2020 · 3 comments
Assignees
Labels
type:question general questions

Comments

@yufeiminds
Copy link

Your Question

When I plan to execute auto migration, we should review the SQL will be executed, how can I do it?

eg. print SQL? execute a dry-run with logging?

The document you expected this should be explained

https://gorm.io/docs/migration.html

@yufeiminds yufeiminds added the type:question general questions label Sep 28, 2020
@jinzhu
Copy link
Member

jinzhu commented Sep 28, 2020

Hi, this is not possible right now, DryRun mode doesn't works with the AutoMigrate as it doesn't fetch database information and can't make the upgrade plan

@yufeiminds
Copy link
Author

Okay, thanks for your reply so quickly. 👍

@malisper
Copy link

@jinzhu What is the recommended way to make sure a migration will do what I expect it to? I don't want to accidentally run a migration that creates a bunch of tables and indexes that I didn't mean to.

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

No branches or pull requests

3 participants