mirror of https://github.com/go-gorm/gorm.git
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
|
var columns []string
|
||||||
for _, name := range column {
|
for _, name := range column {
|
||||||
columns = append(columns, scope.Quote(name))
|
if regexp.MustCompile("^[a-zA-Z]+$").MatchString(name) {
|
||||||
|
columns = append(columns, scope.Quote(name))
|
||||||
|
} else {
|
||||||
|
columns = append(columns, name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlCreate := "CREATE INDEX"
|
sqlCreate := "CREATE INDEX"
|
||||||
|
|
Loading…
Reference in New Issue