12
cmd/migrate/migration/custom/doc.go
Normal file
12
cmd/migrate/migration/custom/doc.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package custom
|
||||
|
||||
/*
|
||||
* @Author: lwnmengjing<lwnmengjing@qq.com>
|
||||
* @Date: 2023/10/31 16:37:31
|
||||
* @Last Modified by: lwnmengjing<lwnmengjing@qq.com>
|
||||
* @Last Modified time: 2023/10/31 16:37:31
|
||||
*/
|
||||
|
||||
// fixme: developer's custom migration script
|
||||
func init() {
|
||||
}
|
||||
28
cmd/migrate/migration/system/1698743462934_tables.go
Normal file
28
cmd/migrate/migration/system/1698743462934_tables.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"github.com/mss-boot-io/mss-boot/pkg/migration"
|
||||
migrationModel "github.com/mss-boot-io/mss-boot/pkg/migration/models"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1691804837583Tables)
|
||||
}
|
||||
|
||||
func _1691804837583Tables(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
err := tx.Migrator().AutoMigrate()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tx.Create(&migrationModel.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
12
cmd/migrate/migration/system/doc.go
Normal file
12
cmd/migrate/migration/system/doc.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package system
|
||||
|
||||
/*
|
||||
* @Author: lwnmengjing<lwnmengjing@qq.com>
|
||||
* @Date: 2023/10/31 16:37:31
|
||||
* @Last Modified by: lwnmengjing<lwnmengjing@qq.com>
|
||||
* @Last Modified time: 2023/10/31 16:37:31
|
||||
*/
|
||||
|
||||
// fixme: developer's custom migration script
|
||||
func init() {
|
||||
}
|
||||
Reference in New Issue
Block a user