File tree 1 file changed +2
-2
lines changed 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -339,15 +339,15 @@ func (m Migrator) GetIndexes(value interface{}) ([]gorm.Index, error) {
339
339
indexes := make ([]gorm.Index , 0 )
340
340
err := m .RunWithValue (value , func (stmt * gorm.Statement ) error {
341
341
rst := make ([]* Index , 0 )
342
- if err := m .DB .Debug ().Raw (fmt . Sprintf ( "PRAGMA index_list(%q )" , stmt .Table )) .Scan (& rst ).Error ; err != nil {
342
+ if err := m .DB .Debug ().Raw ("SELECT * FROM PRAGMA_index_list(? )" , stmt .Table ).Scan (& rst ).Error ; err != nil { // alias `PRAGMA index_list(?)`
343
343
return err
344
344
}
345
345
for _ , index := range rst {
346
346
if index .Origin == "u" { // skip the index was created by a UNIQUE constraint
347
347
continue
348
348
}
349
349
var columns []string
350
- if err := m .DB .Raw (fmt . Sprintf ( "SELECT name from PRAGMA_index_info(%q )" , index .Name ) ).Scan (& columns ).Error ; err != nil { // alias `PRAGMA index_info(?)`
350
+ if err := m .DB .Raw ("SELECT name FROM PRAGMA_index_info(? )" , index .Name ).Scan (& columns ).Error ; err != nil { // alias `PRAGMA index_info(?)`
351
351
return err
352
352
}
353
353
indexes = append (indexes , & migrator.Index {
You can’t perform that action at this time.
0 commit comments