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 {
|
type Migrator interface {
|
||||||
// AutoMigrate
|
// AutoMigrate
|
||||||
AutoMigrate(dst ...interface{}) error
|
AutoMigrate(dst ...interface{}) error
|
||||||
|
After(dst interface{}) error
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
CurrentDatabase() string
|
CurrentDatabase() string
|
||||||
|
@ -147,11 +147,18 @@ func (m Migrator) AutoMigrate(values ...interface{}) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if err := tx.Migrator().After(value); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m Migrator) After(dst interface{}) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (m Migrator) CreateTable(values ...interface{}) error {
|
func (m Migrator) CreateTable(values ...interface{}) error {
|
||||||
for _, value := range m.ReorderModels(values, false) {
|
for _, value := range m.ReorderModels(values, false) {
|
||||||
tx := m.DB.Session(&gorm.Session{})
|
tx := m.DB.Session(&gorm.Session{})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user