Add hooks after completion of Migrate Value
This commit is contained in:
parent
a8db54afd6
commit
298b3ac523
@ -33,6 +33,7 @@ type ColumnType interface {
|
||||
type Migrator interface {
|
||||
// AutoMigrate
|
||||
AutoMigrate(dst ...interface{}) error
|
||||
After(dst interface{}) error
|
||||
|
||||
// Database
|
||||
CurrentDatabase() string
|
||||
|
@ -147,11 +147,18 @@ func (m Migrator) AutoMigrate(values ...interface{}) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := tx.Migrator().After(value); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m Migrator) After(dst interface{}) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m Migrator) CreateTable(values ...interface{}) error {
|
||||
for _, value := range m.ReorderModels(values, false) {
|
||||
tx := m.DB.Session(&gorm.Session{})
|
||||
|
Loading…
x
Reference in New Issue
Block a user