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

AutoMigrate panic #3411

Closed
HelloHaiGG opened this issue Sep 7, 2020 · 6 comments
Closed

AutoMigrate panic #3411

HelloHaiGG opened this issue Sep 7, 2020 · 6 comments
Assignees
Labels

Comments

@HelloHaiGG
Copy link

HelloHaiGG commented Sep 7, 2020

GORM Playground Link

I used automigrate to create tables , the models is a slice and item type is interface , panic

For Example:

for _, model := range models {
	err := dbIns.AutoMigrate(model)
	fmt.Println(err)
}
@github-actions github-actions bot added the type:missing reproduction steps missing reproduction steps label Sep 7, 2020
@HelloHaiGG
Copy link
Author

help me,please!

@github-actions
Copy link

github-actions bot commented Sep 7, 2020

This issue has been automatically marked as stale as it missing playground pull request link, checkout https://github.com/go-gorm/playground for details, it will be closed in 2 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.ioSearch Before Asking

@ap-in-git
Copy link

for _, model := range models {
err := dbIns.AutoMigrate(&model)
fmt.Println(err)
}

This may help

@HelloHaiGG
Copy link
Author

for _, model := range models {
err := dbIns.AutoMigrate(&model)
fmt.Println(err)
}

This may help

model is pointer

@github-actions
Copy link

github-actions bot commented Sep 7, 2020

This issue has been automatically marked as stale as it missing playground pull request link, checkout https://github.com/go-gorm/playground for details, it will be closed in 2 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.ioSearch Before Asking

@jinzhu
Copy link
Member

jinzhu commented Sep 7, 2020

allModels := []interface{}{&User{}, &Account{}, &Pet{}, &Company{}, &Toy{}, &Language{}}

@jinzhu jinzhu closed this as completed Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants