20 lines
344 B
Go
20 lines
344 B
Go
package ptpl
|
|
|
|
import (
|
|
"bamort/database"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// MigrateStructure runs the auto-migration for models owned by this module.
|
|
func MigrateStructure(db ...*gorm.DB) error {
|
|
var targetDB *gorm.DB
|
|
if len(db) > 0 && db[0] != nil {
|
|
targetDB = db[0]
|
|
} else {
|
|
targetDB = database.DB
|
|
}
|
|
|
|
return targetDB.AutoMigrate(&PtplItem{})
|
|
}
|