Fix create index with comments in MySQL
This commit is contained in:
parent
d4f3c109d6
commit
ba7731967a
@ -195,6 +195,10 @@ func (m Migrator) CreateTable(values ...interface{}) error {
|
|||||||
}
|
}
|
||||||
createTableSQL += "INDEX ? ?"
|
createTableSQL += "INDEX ? ?"
|
||||||
|
|
||||||
|
if idx.Comment != "" {
|
||||||
|
createTableSQL += fmt.Sprintf(" COMMENT '%s'", idx.Comment)
|
||||||
|
}
|
||||||
|
|
||||||
if idx.Option != "" {
|
if idx.Option != "" {
|
||||||
createTableSQL += " " + idx.Option
|
createTableSQL += " " + idx.Option
|
||||||
}
|
}
|
||||||
@ -601,6 +605,10 @@ func (m Migrator) CreateIndex(value interface{}, name string) error {
|
|||||||
createIndexSQL += " USING " + idx.Type
|
createIndexSQL += " USING " + idx.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if idx.Comment != "" {
|
||||||
|
createIndexSQL += fmt.Sprintf(" COMMENT '%s'", idx.Comment)
|
||||||
|
}
|
||||||
|
|
||||||
if idx.Option != "" {
|
if idx.Option != "" {
|
||||||
createIndexSQL += " " + idx.Option
|
createIndexSQL += " " + idx.Option
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user