forked from mirror/gorm
Don't quote column if it is not only column name when create index
This commit is contained in:
parent
5663048f13
commit
4c3daade4c
|
@ -515,7 +515,11 @@ func (scope *Scope) addIndex(unique bool, indexName string, column ...string) {
|
|||
|
||||
var columns []string
|
||||
for _, name := range column {
|
||||
if regexp.MustCompile("^[a-zA-Z]+$").MatchString(name) {
|
||||
columns = append(columns, scope.Quote(name))
|
||||
} else {
|
||||
columns = append(columns, name)
|
||||
}
|
||||
}
|
||||
|
||||
sqlCreate := "CREATE INDEX"
|
||||
|
|
Loading…
Reference in New Issue