Skip to content

Commit

Permalink
Merge pull request #137 from joykk/main
Browse files Browse the repository at this point in the history
修复panic: interface conversion: sharding.ShardingMigrator is not migrato…
  • Loading branch information
jinzhu authored Nov 22, 2023
2 parents 030c028 + 00679c2 commit b4dbc43
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dialector.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package sharding

import (
"fmt"
"gorm.io/gorm/migrator"
"gorm.io/gorm/schema"

"gorm.io/gorm"
)
Expand Down Expand Up @@ -61,6 +63,11 @@ func (m ShardingMigrator) AutoMigrate(dst ...any) error {
return nil
}

// BuildIndexOptions build index options
func (m ShardingMigrator) BuildIndexOptions(opts []schema.IndexOption, stmt *gorm.Statement) (results []interface{}) {
return m.Migrator.(migrator.BuildIndexOptionsInterface).BuildIndexOptions(opts, stmt)
}

func (m ShardingMigrator) DropTable(dst ...any) error {
shardingDsts, noShardingDsts, err := m.splitShardingDsts(dst...)
if err != nil {
Expand Down

0 comments on commit b4dbc43

Please sign in to comment.