Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: automigrate error caused by indexes while using dynamic table name #4773

Merged
merged 1 commit into from
Oct 19, 2021

Conversation

xwjdsh
Copy link
Contributor

@xwjdsh xwjdsh commented Oct 12, 2021

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

close #4752

@xwjdsh
Copy link
Contributor Author

xwjdsh commented Oct 12, 2021

@longlihale I revised it again and now it's OK. The CI's error should be nothing to do with my revision, I have seen the same error in the master branch.

@ghost ghost requested review from a user and jinzhu October 14, 2021 14:31
@huacnlee
Copy link
Collaborator

测试逻辑有些复杂看不出覆盖的场景,可以简单直接一些

@xwjdsh
Copy link
Contributor Author

xwjdsh commented Oct 19, 2021

已更新。

@@ -107,6 +116,9 @@ func Parse(dest interface{}, cacheStore *sync.Map, namer Namer) (*Schema, error)

modelValue := reflect.New(modelType)
tableName := namer.TableName(modelType.Name())
if schemaTable != "" {
tableName = schemaTable
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

反过来写

tableName = schemaTable
if schemaTable == "" {
  tableName := namer.TableName(modelType.Name())
}

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automigrate error caused by indexes while using dynamic table name
2 participants